Subversion Repositories wimsdev

Rev

Rev 13610 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /* bubble_talk.css */
  2. /* display a comic bubble talk */
  3. /* credits : http://codepen.io/Founts/pen/gmhcl */
  4.  
  5. /** Minimum html required :
  6. <div class="talk-bubble">
  7.   <div class="talktext">
  8.     <p>CSS Talk Bubble configured by classes. Defaults to square shape, no triangle. Height is auto-adjusting to the height of the text.</p>
  9.   </div>
  10. </div>
  11. **/
  12.  
  13. /*** Availables options for "talk-bubble" :
  14. * triangle : puts a triangle indicating from where comes the speaker. Must be positioned in on of these position :
  15.   ** left-top
  16.   ** left-in
  17.   ** btm-left
  18.   ** btm-left-in
  19.   ** btm-right
  20.   ** btm-right-in
  21.   ** right-in
  22.   ** right-top
  23. * border : an 8px border around bubble
  24. * round  : rounded borders
  25. * shadow : a light shadow around bubble
  26.  
  27. *****************************/
  28.  
  29.  
  30. /***************
  31.  example of OEF if you want to test it :
  32. ****************
  33.  
  34. \text{A1=slib(text/balloon [Abracadabra ],,200)}
  35. \text{B1=slib(text/balloon [Que vaut \(\frac{1}{2}\) de 6 ? ],lightblue,400,100,
  36. rectangle noshadow triangle=btm-left)}
  37.  
  38. \text{A2=slib(text/balloon [Abracadabra ],red,,,triangle=btm-right)}
  39. \text{B2=slib(text/balloon [Que vaut \(\frac{1}{2}\) de 6 ? ],lightblue,200,100,
  40. rectangle border triangle=right-in)}
  41.  
  42. \statement{
  43. <div>Bernadette\A1 Olivier\B1</div>
  44. <div>Aziz\A2 Roberto\B2</div>
  45. }
  46.  
  47. *********************/
  48.  
  49. /* talk bubble Main class */
  50. .talk-bubble {
  51.   margin: 0 20px 20px 20px;
  52.   /*display: inline-block;*/
  53.   position: relative;
  54.   /*width: 200px;*/
  55.   height: auto;
  56.   background-color: lightyellow;
  57. }
  58.  
  59. /* optional styles : border round shadow */
  60. .talk-bubble.border{
  61.   border: 8px solid #666;
  62.   margin: 0 30px 30px 30px;
  63. }
  64. .talk-bubble.round{ border-radius: 30px;}
  65. .talk-bubble.shadow{
  66.   box-shadow: 8px 4px 5px 0 #ccc;
  67.   /*margin-bottom: 10px;*/
  68. }
  69.  
  70. /* Optional : a triangle indicating who's speaking direction */
  71. .triangle:before, .triangle:after {
  72.   content: ' ';
  73.   position: absolute;
  74.   width: 0;
  75.   height: 0;
  76. }
  77.  
  78. /* Triangle placed top left flush. */
  79. .triangle.border.left-top:before {
  80.   left: -40px;
  81.   right: auto;
  82.   top: -8px;
  83.   bottom: auto;
  84.   border: 32px solid;
  85.   border-color: #666 transparent transparent transparent;
  86. }
  87. .triangle.left-top:after{
  88.   left: -20px;
  89.   right: auto;
  90.   top: 0;
  91.   bottom: auto;
  92.   border: 22px solid transparent;
  93. }
  94.  
  95. /* Right triangle, left side slightly down */
  96. .triangle.border.left-in:before {
  97.   left: -40px;
  98.   right: auto;
  99.   top: 30px;
  100.   bottom: auto;
  101.   border: 20px solid;
  102.   border-color: #666 #666 transparent transparent;
  103. }
  104. .triangle.left-in:after{
  105.   left: -20px;
  106.   right: auto;
  107.   top: 38px;
  108.   bottom: auto;
  109.   border: 12px solid transparent;
  110. }
  111.  
  112. /* Triangle, placed bottom left side slightly in*/
  113. .triangle.border.btm-left:before {
  114.   left: -8px;
  115.   right: auto;
  116.   top: auto;
  117.   bottom: -40px;
  118.   border: 32px solid;
  119.   border-color: transparent transparent transparent #666;
  120. }
  121. .triangle.btm-left:after{
  122.   left: 0;
  123.   right: auto;
  124.   top: auto;
  125.   bottom: -20px;
  126.   border: 22px solid transparent;
  127. }
  128.  
  129. /* Triangle, placed bottom left side slightly in*/
  130. .triangle.border.btm-left-in:before {
  131.   left: 30px;
  132.   right: auto;
  133.   top: auto;
  134.   bottom: -40px;
  135.   border: 20px solid;
  136.   border-color: #666 transparent transparent #666;
  137. }
  138. .triangle.btm-left-in:after{
  139.   left: 38px;
  140.   right: auto;
  141.   top: auto;
  142.   bottom: -20px;
  143.   border: 12px solid transparent;
  144. }
  145.  
  146. /* Triangle, placed bottom right side slightly in*/
  147. .triangle.border.btm-right-in:before {
  148.   left: auto;
  149.   right: 30px;
  150.   bottom: -40px;
  151.   border: 20px solid;
  152.   border-color: #666 #666 transparent transparent;
  153. }
  154. .triangle.btm-right-in:after{
  155.   left: auto;
  156.   right: 38px;
  157.   bottom: -20px;
  158.   border: 12px solid transparent;
  159. }
  160. /*
  161.   left: -8px;
  162.   right: auto;
  163.   top: auto;
  164.   bottom: -40px;
  165.   border: 32px solid;
  166.   border-color: transparent transparent transparent #666;
  167.   left: 0;
  168.   right: auto;
  169.   top: auto;
  170.   bottom: -20px;
  171.   border: 22px solid;
  172.   border-color: transparent transparent transparent lightyellow;
  173.  
  174. /* Triangle, placed bottom right side slightly in*/
  175. .triangle.border.btm-right:before {
  176.   left: auto;
  177.   right: -8px;
  178.   bottom: -40px;
  179.   border: 20px solid;
  180.   border-color: #666 #666 transparent transparent;
  181. }
  182. .triangle.btm-right:after{
  183.   left: auto;
  184.   right: 0;
  185.   bottom: -20px;
  186.   border: 12px solid transparent;
  187. }
  188.  
  189. /* Triangle, right side slightly down*/
  190. .triangle.border.right-in:before {
  191.   left: auto;
  192.   right: -40px;
  193.   top: 30px;
  194.   bottom: auto;
  195.   border: 20px solid;
  196.   border-color: #666 transparent transparent #666;
  197. }
  198. .triangle.right-in:after{
  199.   left: auto;
  200.   right: -20px;
  201.   top: 38px;
  202.   bottom: auto;
  203.   border: 12px solid transparent;
  204. }
  205.  
  206. /* Triangle placed top right flush. */
  207. .triangle.border.right-top:before {
  208.   left: auto;
  209.   right: -40px;
  210.   top: -8px;
  211.   bottom: auto;
  212.   border: 32px solid;
  213.   border-color: #666 transparent transparent transparent;
  214. }
  215. .triangle.right-top:after{
  216.   left: auto;
  217.   right: -20px;
  218.   top: 0;
  219.   bottom: auto;
  220.   border: 20px solid transparent;
  221. }
  222.  
  223. /* talk bubble contents */
  224. .talktext{
  225.   padding: 1em;
  226.   text-align: left;
  227.   line-height: 1.5em;
  228. }
  229.  
  230. /* triangle color */
  231. .triangle:not(.btm-left):after{border-top-color: lightyellow;}
  232.  
  233. .triangle.left-in:after{     border-right-color: lightyellow;}
  234. .triangle.btm-left:after{    border-left-color:  lightyellow;}
  235. .triangle.btm-left-in:after{ border-left-color:  lightyellow;}
  236.  
  237. .triangle.btm-right-in:after{border-right-color: lightyellow;}
  238. .triangle.btm-right:after{   border-right-color: lightyellow;}
  239. .triangle.right-in:after{    border-left-color:  lightyellow;}
  240.  
  241.  
  242. /* creates the larger circle */
  243. .talk-bubble.thought:before {
  244.   content:"";
  245.   position:absolute;
  246.   bottom:-20px;
  247.   left:50px;
  248.   width:30px;
  249.   height:30px;
  250.   background:#075698;
  251.   /* css3 */
  252.   border-radius:30px;
  253. }
  254.  
  255. /* creates the smaller circle */
  256. .talk-bubble.thought:after {
  257.   content:"";
  258.   position:absolute;
  259.   bottom:-30px;
  260.   left:30px;
  261.   width:15px;
  262.   height:15px;
  263.   background:#075698;
  264.   /* css3 */
  265.   border-radius:15px;
  266. }
  267.  
  268. .talk-bubble.thought{margin-bottom:2.5em;}
  269.  
  270. /* Bubble speaker : display the name of the speaker at the right place (cf slib/balloon) */
  271. .bubble_speaker.left-top,.bubble_speaker.right-top{vertical-align:top}
  272. .talk-bubble.left-top,.talk-bubble.right-top{margin-top:.5em;}
  273. .bubble_speaker.btm-left{left:.5em}
  274. .bubble_speaker.btm-left-in{left:40px}
  275. .bubble_speaker.btm-right-in{right:40px;}
  276. .bubble_speaker.btm-right{ right:.5em;}
  277. /*
  278. .bubble_speaker.right-in{}
  279. .bubble_speaker.left-in{}
  280. */
  281.  
  282. /*.talktext p{
  283.   /* remove webkit p margins */
  284.   /*-webkit-margin-before: 0em;
  285.   -webkit-margin-after: 0em;*/
  286. /*}*/