Forum Moderators: open

Message Too Old, No Replies

Dotted or Dashed lines

I don't know how to make them

         

Roxster

9:05 pm on Oct 16, 2006 (gmt 0)

10+ Year Member



I want dotted or dashes instead of a solid line in a table or cells. Can this be done in HTML? Or do I have to assign it in CSS?

dillonstars

9:44 pm on Oct 16, 2006 (gmt 0)

10+ Year Member



You have to do it with CSS and it is easiest to have the CSS code in the head like:

<style type="text/css">
<!--
td {
border: 1px dotted #000;
}
-->
</style>

(replace 'dotted' for 'dashed' if you wish)

The only problem with this is that it outlines each cell with a border, so where you have 2 cells next to eachother you get a double thickness width.

To get an equal border width throughout the whole table you can use:

<style type="text/css">
<!--
table {
border-top: 1px dotted #000;
border-left: 1px dotted #000;
}
td {
border-bottom: 1px dotted #000;
border-right: 1px dotted #000;
}

-->
</style>

choster

1:32 pm on Oct 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Also note that Internet Explorer through version 6 renders dotted lines as dashed.

Rather than setting top and left margins, wouldn't setting border-collapse:collapse work just as well?

dillonstars

3:51 pm on Oct 17, 2006 (gmt 0)

10+ Year Member



border-collapse:collapse

never heard of that, will play around... thanks :)