I have a basic HTML table which contains table rows. My goal is to separate those table rows with a visible line (for better readability of the content).
How could I do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are several ways to do that. Using HTML alone, you can write
or, if you want a border above the first row and below the last row too,
This is rather inflexible, though; you cannot e.g. make the lines dotted this way, or thicker than one pixel. This is why in the past people used special separator rows, consisting of nothing but some content intended to produce a line (it gets somewhat dirty, especially when you need to make rows e.g. just a few pixels high, but it’s possible).
For the most of it, people nowadays use CSS
borderproperties for the purpose. It’s fairly simple and cross-browser. But note that to make the lines continuous, you need to prevent spacing between cells, using either thecellspacing=0attribute in thetabletag or the CSS ruletable { border-collapse: collapse; }. Removing such spacing may necessitate adding some padding (with CSS, preferably) inside the cells.At the simplest, you could use
This puts a border above the first row and below the last row too. To prevent that, add e.g. the following into the style sheet: