Solved

css table collapse

Posted on 2010-11-29
4
328 Views
Last Modified: 2012-05-10
Hi,

I was running
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
table
{
border-collapse:collapse;
}
table, td, th
{
border:1px solid black;
}
</style>
</head>

<body>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
<tr>
<td>Lois</td>
<td>Griffin</td>
</tr>
</table>
<p><b>Note:</b> If a !DOCTYPE is not specified, the border-collapse property can produce unexpected results.</p>
</body>
</html>

Open in new window



I have not understood


>>the border-collapse property sets whether the table borders are collapsed into a single border or separated:


please advise
0
Comment
Question by:gudii9
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
qwerty021600 earned 167 total points
ID: 34236472
border-collapse property collapsed table borders into a single border
0
 
LVL 7

Assisted Solution

by:lexlythius
lexlythius earned 167 total points
ID: 34236578
collapsing means that TD's borders get mixed together with no spacing.

In the attached image, the second table is identical to the first one, only its borders are collapsed:


border-collapse.png
0
 
LVL 44

Assisted Solution

by:scrathcyboy
scrathcyboy earned 166 total points
ID: 34245235
You use border collapse when you want a thin line between table cells.  The other way to do this is

TABLE  { border: 1px solid green }
0
 
LVL 7

Expert Comment

by:lexlythius
ID: 34366867
The other way to do this is

TABLE  { border: 1px solid green }

That is not correct.

If you only put that style, TABLE will have a 1px outer border, but cells will have none.

If you also set the style for TDs, inner borders will be drawn, but for each cell separately (and possibly with padding between them).
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

776 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