Solved

css table collapse

Posted on 2010-11-29
4
326 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
[Probably Simple] Responsive CSS Layout Question 4 45
SVG Star 4 18
HTML CSS 7 19
Retrieve values of an HTML form using JQUERY 2 17
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

762 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now