A simple line in CSS, how to...?

admin

Administrator
Staff member
Hi There.

What's the best way to get a line like that in CSS:


<table border="0" cellpadding="0" cellspacing="0" width="750">
<tr>
<td height="10" bgcolor="#4c6baf"><img src=http://www.webdeveloper.com/forum/archive/index.php/"spacer.gif" width="1" height="1" border="0"></td>
</tr>
</table>


Thanks!this could be achieved with a 10px border methinks.<table border="0" cellpadding="0" cellspacing="0" width="750">
<tr>
<td height="10" bgcolor="#4c6baf"><img src=http://www.webdeveloper.com/forum/archive/index.php/"spacer.gif" width="1" height="1" border="0"></td>
</tr>
</table>
<p>And now for something completely different.</p>
<div style="width:750px;height:10px;background:#4c6baf;font-size:7px;"></div>

The font-size is a hack to make IE look somewhat right. Real browsers don't need it. Or as Sam said.

<p>And now for something completely different.</p>
<div style="width:750px;border-top:10px solid #4c6baf;"></div>I mean... the line is there but I'm getting like an automatic <BR> under it I don't want that <BR>.
how can I cancel it?

Thanks guys!URL?I just did what ray326 told me.
it shouldn't be like that?Probably the fact a div is block level, so it has a line break after it?? either set the div font size, or type inside the div...

It could be the margins/padding on the p tag underneath:

<p>And now for something completely different.</p>
<div style="width:750px;height:10px;background:#4c6baf;font-size:7px; margin: 0; padding: 0;"></div>
<p style="margin: 0; padding: 0;">Hello</p>

Do you mean the space under the line in IE6?ThanksThe reason I asked for a URL at that point was to see exactly what you were trying to do. It might be that the best approach would be to define what you're thinking of as the "following tag" to simple have that as its border-top.!
 
Back
Top