Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Proper use of CSS to create a table border

Status
Not open for further replies.

thp1111

Programmer
Jul 23, 2003
2
US
I am totally and completely new to CSS (and find it very confusing!). Here's my problem:

.news{padding:15px; font-family:Tahoma, Verdana;font-size:10px; background-color:#FFFF99;border-left-style:solid; border-color:white;border-left-width:2.0mm; border-right-style:solid; border-right-width:0.0mm; border-top-style:solid; border-top-width:0.0mm; border-bottom-style:solid; border-bottom-width:0.0mm}

Notice I have to add a thick white border to the left of the table to add spacing between the table and my body text? This just doesn't seem right. Can anybody suggest something better??

The table is defined as:

<table border=&quot;0&quot; cellpadding=&quot;2&quot; class=&quot;news&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse&quot; id=&quot;AutoNumber4&quot; width=&quot;161&quot; align=&quot;right&quot;>

There is no style defined for the cell itself.
 
I'm not entirely sure what you're asking. If you want to know if this is the appropriate way of adding a border to a table using CSS, the answer is yes. If your question was more on ways to put space between elements, put your news table into a div with the padding-left attribute set to the width you're after.
 
Thank you. That was my question. I certainly could use a white border to fake a separation, but then I can't have a border!

I'm assuming I could do this:

<div style=&quot;padding-left:10px&quot;>
<table blah blah blha

</table>
</div>


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top