Forum Moderators: not2easy

Message Too Old, No Replies

Can CSS remove the line breaks after Tables?

</table>?

         

alcheme

10:20 pm on Aug 19, 2003 (gmt 0)

10+ Year Member



I am using two scripts in a table. For some reason a line break occurs between the table and the horizontal line or text I place underneath it.

Can CSS get rid of this line break?

~Shane

______________________________________

<hr color="#FFFFFF"><br>
<a name="Weather"></a>
<table width="24%" border="0" align="center" cellpadding="10" cellspacing="2">
<tr align="center" valign="top">
<td nowrap><div align="center">
<script language=javascript>var city = 'Nanaimo_BC';</script>
<script language=javascript src='http://www.theweathernetwork.com/weatherbutton/test.js'></script></div></td>
<td nowrap><div align="center">
<script language=JavaScript src='http://www.theweathernetwork.com/weatherbutton/search/150X90.js'></script>
</div></td>
</tr>
</table>
<hr>
__________________________________________

MonkeeSage

10:26 pm on Aug 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Shane:

What do you mean? Are you trying to show text on the same line as the <hr>, or trying to show the <hr> next to the table, or...?

Jordan

alcheme

10:33 pm on Aug 19, 2003 (gmt 0)

10+ Year Member



The <hr> 'horizontal line' is located below the table. The text below the horizontal line. I meant I tried both the horizontal line and text below the table and both had the same result: a line break.

My browser (IE6) creates a line break between </TABLE> and <hr>.

~Shane

MatthewHSE

11:15 pm on Aug 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



From my experience, the effect you're noticing is from the hr. Try setting it to display:inline; and see if that helps.

MonkeeSage

11:20 pm on Aug 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is this what you are trying to do:

+-----+
¦........¦ ------------
¦........¦ blah blah
+-----+

?

Jordan

pageoneresults

11:22 pm on Aug 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



table{margin-bottom:0;}
hr{margin-top:0;}

I believe that would put the hr right at the bottom of the table. So, you may want to change the table to...

table{margin-bottom:.5em;}

You could also approach this another way and do something like this...

table{border-top:.1em solid #000;border-bottom:.1em solid #000;}

...and skip the whole <hr> thing.

Just experiment with the margin attributes on those two elements and you should be able to come up with a suitable arrangement to meet your requirements.

shelleycat

3:03 am on Aug 20, 2003 (gmt 0)

10+ Year Member



Sometimes putting ending tags on new lines will make Internet Explorer add line breaks there as well. So try:

</script></div></td></tr></table>

and see if it makes any difference.

alcheme

6:59 am on Aug 20, 2003 (gmt 0)

10+ Year Member



RE: MonkeySage

No, this is what I mean;

------------<hr>
+-----+
¦.....¦
¦.....¦
+-----+
------------<hr>
blah blah

pearl

7:03 am on Aug 20, 2003 (gmt 0)

10+ Year Member



shelley,

I have never seen this happen - sorry.

alcheme

7:29 pm on Aug 20, 2003 (gmt 0)

10+ Year Member



RE: PAGEONERESULTS

?Where in the CSS feature of Dreamweaver can I define these values you gave me?

""table{margin-bottom:0;}""
""hr{margin-top:0;}""

I cannot find a box for margins. Basically I am not sure how to create a CSS definition like the one above.

?Also, do I place the cursor after the table in the HTML view and paste in the CSS once I know how to make this CSS definition?

~Shane

[edited by: alcheme at 8:04 pm (utc) on Aug. 20, 2003]

pageoneresults

7:33 pm on Aug 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Not a DW user but there are plenty around. For now, you can embed it in the <head> of the page for testing purposes. You could also leave it there if it is for this one page only.

<head>
<title>
<other metadata/head elements>
<style type="text/css">
table{margin-bottom:0;}
hr{margin-top:0;}
</style>
</head>

shelleycat

11:55 pm on Aug 20, 2003 (gmt 0)

10+ Year Member



I have never seen this happen - sorry.

Well I did say sometimes :D

I'm not sure what, if any, rules IE follows for this, but I have found in the past it can fix weird errors such as extra margins or line spaces appearing where they shouldn't. And I've found that if you don't know it's a possiblity then you can spend days looking for the problem, when it's actually easily fixed. And it only takes a second to test, so I figured it was worth a mention :)

SuzyUK

11:01 am on Aug 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes.. and in this case is possibly the only way to do it..

The problem here, for me anyway ;), is that the code that is being written/generated by the Javascript is causing the problem

the "line feed" is inside the table (try putting colored borders on the table, you'll see there are nested tables being generated) but on reading the .js file there is also a <form> in there and it's this that's causing the "gap"

try adding this:
td form{
margin: 0;
padding: 0;
}

into the CSS as described by P1R in post #11.. then any remaing gaps are probably being caused by cellpadding and cellspacing on your table

Suzy