How do I make a dotted line with CSS?
Looking for the best way to create a dotted line with CSS and the attributes that are available with that.
Status:
Open Feb 25, 2007 - 09:29 AM
css, Dotted Lines, Attributes, styling, web development
3answers
Answers
Feb 26, 2007 - 11:51 AM
They way I am thinking to create a dotted line with css is to use the BORDER property.
This is an example:
Because borders are attached to boxes, you want to specify which border to display: top, bottom, left or right. The first parameter specifies the thickness, the second that it should be dotted and the last is the rgb color code.
The length of the line will depend on - in this case - the width of your box, which you can set with the width property.
You can probably do something with the
element as well (which is by nature a line - a horisontal rule), but since this one is styled so differently in various browsers, I think it is not worth trying.
Feb 26, 2007 - 11:58 AM
How would it be displayed on a .css page?
Feb 26, 2007 - 12:14 PM
I use inline style in the example only because it is shorter - of course it's probably best to put the style in a class in an external .css document.
The translation is very easy:
and in styles.css:
.horizontal_dotted_line
{
border-bottom: 1px dotted #80c080;
width: 100px;
}
I hope that was what you meant.
Answer this question
Share Your Own Experience & Expertise
We look to ensure that every question is answered by the best people with relevant expertise and experience, the best answers include multiple perspectives. Do you have relevant expertise or experience to contribute your answer to any of these commonly asked questions?
Add New Comment