MyBB Codes

Full Version: How to create ballons talking text...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This tutorial will show you how easy it can be to show speech bubbles.

The method used is a table with different CSS backgrounds using only two small images. Here is an example of what you can do to display your text :



Here are the two images used for this example :




The CSS content is this :


PHP Code:[Highlight]
.table_bubble{
  
background-color transparent;
  
padding:0;
  
margin:0;
  
spacing:0;
  
bordernone;
}
.
table_bubble_top_left{
  
background transparent url(Bubble.gifno-repeat left top;
  
padding-top32px;
  
padding-left32px;
  
padding-bottom8px;
  
font-weightbold;
}
.
table_bubble_top_right{
  
backgroundtransparent url(Bubble.gifno-repeat right top;
  
width40px;
}
.
table_bubble_center_left{
  
background transparent url(BubbleCenter.gifleft top;
  
padding-left32px;
  
color:#0000ff;
}
.
table_bubble_center_right{
  
background transparent url(BubbleCenter.gifright top;
  
width40px;
}
.
table_bubble_bottom_left{
  
background transparent url(Bubble.gifno-repeat left bottom;
  
height 48px;
}
.
table_bubble_bottom_right{
  
backgroundtransparent url(Bubble.gifno-repeat right bottom;
  
width40px;


The HTML content is this :

PHP Code:[Highlight]
<table class="table_bubble" cellpadding="0" cellspacing="0">
 <
tr>
  <
td class="table_bubble_top_left">Speech bubble sample #1</td>
  
<td  class="table_bubble_top_right"></td>
 </
tr>
 <
tr>
  <
td  class="table_bubble_center_left">
   
You can have a very long line of text displayed with no interruptions...
  </
td>
  <
td class="table_bubble_center_right"></td>
 </
tr>
 <
tr>
  <
td class="table_bubble_bottom_left"></td>
  <
td class="table_bubble_bottom_right"></td>
 </
tr>
</
table>
<
table class="table_bubble" cellpadding="0" cellspacing="0">
 <
tr>
  <
td class="table_bubble_top_left">Speech bubble sample #2</td>
  
<td  class="table_bubble_top_right"></td>
 </
tr>
 <
tr>
  <
td  class="table_bubble_center_left">
   Or 
you can<br / >
   
have multiple<br / >
   
lines over<br / >
   
each other...
  </
td>
  <
td class="table_bubble_center_right"></td>
 </
tr>
 <
tr>
  <
td class="table_bubble_bottom_left"></td>
  <
td class="table_bubble_bottom_right"></td>
 </
tr>
</
table

As you can see this is quite simple to do, the trick is only use a 2 columns 3 rows table!

More explanations will come soon...
nice tutorial man,ty
very nice, thanks
thanks and nice tut!
This is cool but where does the html go?
(01-31-2011 11:33 AM)JonP Wrote: [ -> ]This is cool but where does the html go?

You can put the HTML in any templates, as an example, use it in the post template to display the $message variable.

Wink
hm.. Nice Tutorial Thanks Smile
Reference URL's