Solved

Simplest approach to making a border for a table in CSS via CSS Class....

Posted on 2011-09-13
5
231 Views
Last Modified: 2012-05-12
Hi,

My brain is not working today!!!

I need to specify a simple rule in a class to make all of a table have a 1px border for all of its cells be they THs or TDs.

Also I noticed when I used "border-left" I got the border only where there was text so if I have 2 columns, one with 2 rows worth of text(wrapped around), the one is only one row produced half a "border-left" border if you get me.

So what is the simplest CSS method to specify a border throughout a table?

Thanks,

Sam

0
Comment
Question by:SamJolly
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 38

Assisted Solution

by:Tom Beck
Tom Beck earned 150 total points
ID: 36528795
table, th, td {border:solid 1px black}
0
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 150 total points
ID: 36528797
#table1 tbody tr td, #table1 tbody tr th
{
   border: 1px solid #000;
}

or

td, th
{
   border: 1px solid #000;
}


simplest way is
<table border="1">

check this too
http://www.ahfb2000.com/webmaster_help_desk/showthread.php?t=1790
0
 
LVL 22

Accepted Solution

by:
Kim Walker earned 200 total points
ID: 36528867
Some browsers will not put borders around empty cells so you must put at least an &nbsp; character in each cell. If you also want to eliminate the double border between cells, you can use the border-collapse property. The border-collapse property also takes care of the empty cells in most cases.

table { border-collapse: collapse; }

Open in new window

0
 

Author Comment

by:SamJolly
ID: 36528953
xmediaman: you little tit bit about border-collapse came just in time ! Thanks....
0
 

Author Closing Comment

by:SamJolly
ID: 36992052
thks all.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Put check in your check box 7 17
Make page layout not change with page 1 24
Need help with FaceBook login 2 20
CSS for Popup in ASP.NET 4 19
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question