tgc
07-14-2011, 03:57 PM
I have a seemingly easy requirement to place a comment bubble next to a title in a list of articles that would contain the number of comments it's received.
I tried to put an div with the bubble as a background with centered text to put the number of comments in.
The only say I seem to be able to do it it either disregards my sizing of the div so the bubble isn't visible, or I set the display to block which puts it on a new line which isn't what I want.
My code seems straight forward?:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body, p, td, div {
font-family:Arial, Helvetica, sans-serif;
font-size:12px
}
div.article {
clear:both;
padding-bottom:60px;
}
div.article img{
float:left;
padding:0px 10px 10px 0px;
}
div.article .articleTitle{
font-size:16px;
font-weight:bold;
color:#36F;
}
div.article .articleDate{
font-size:10px;
font-weight:bold;
color:#666;
}
div.commentBubble{
background-image: url(comment_bubble.gif);
background-repeat: no-repeat;
text-align: center;
display:inline;
color: #666;
font-weight: bold;
font-size: 12px;
width: 32px;
height: 30px;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}
</style>
</head>
<body>
<div class="article">
<img src="shake.jpg" width="89" height="89" alt="shake" />
<span class="articleTitle">Title of story 1<div class="commentBubble">45</div><br /></span>
<span class="articleDate">July 11, 2011<br /></span>
Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum
text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem
ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.
Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.
</div>
</body>
</html>
A mock up of what I want is simply:
http://www.kamunga.com/bubble/commentbubble.jpg
but I get:
http://www.kamunga.com/bubble/commentbubble2.jpg
and a copy of the code to play with is:
http://www.kamunga.com/bubble/commentBubble.zip
Any help or hints would be greatly appreciated!!
I tried to put an div with the bubble as a background with centered text to put the number of comments in.
The only say I seem to be able to do it it either disregards my sizing of the div so the bubble isn't visible, or I set the display to block which puts it on a new line which isn't what I want.
My code seems straight forward?:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body, p, td, div {
font-family:Arial, Helvetica, sans-serif;
font-size:12px
}
div.article {
clear:both;
padding-bottom:60px;
}
div.article img{
float:left;
padding:0px 10px 10px 0px;
}
div.article .articleTitle{
font-size:16px;
font-weight:bold;
color:#36F;
}
div.article .articleDate{
font-size:10px;
font-weight:bold;
color:#666;
}
div.commentBubble{
background-image: url(comment_bubble.gif);
background-repeat: no-repeat;
text-align: center;
display:inline;
color: #666;
font-weight: bold;
font-size: 12px;
width: 32px;
height: 30px;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}
</style>
</head>
<body>
<div class="article">
<img src="shake.jpg" width="89" height="89" alt="shake" />
<span class="articleTitle">Title of story 1<div class="commentBubble">45</div><br /></span>
<span class="articleDate">July 11, 2011<br /></span>
Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum
text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem
ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.
Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.Lorem ipsum text.
</div>
</body>
</html>
A mock up of what I want is simply:
http://www.kamunga.com/bubble/commentbubble.jpg
but I get:
http://www.kamunga.com/bubble/commentbubble2.jpg
and a copy of the code to play with is:
http://www.kamunga.com/bubble/commentBubble.zip
Any help or hints would be greatly appreciated!!