tags:

views:

481

answers:

7

Hi;

How can i draw dotted line with css? i searched but could not find.

thanks

A: 
.myclass {
    border-bottom: thin red dotted;
}
Graeme Perrow
Its a dashed line, not dotted one.
rahul
Fixed. I was mixing up dotted and dashed. Plus my answer would have given you a whole border rather than a single line.
Graeme Perrow
+3  A: 

Do you mean something like 'border: 1px dotted black'?

w3schools.com reference

ChssPly76
Like <hr> but dotted.
Kaveh
+3  A: 

Found the answer here using Google search "css dotted lines":

<div class="horizontal_dotted_line"></div>

and in styles.css:

.horizontal_dotted_line{
  border-bottom: 1px dotted [color];
  width: [put your width here]px;
}
Brendan Long
+3  A: 
<style>
    .dotted {border: 1px dotted #ff0000; border-style: none none dotted; color: #fff; background-color: #fff; }
</style>
<hr class='dotted' />
rahul
+2  A: 

For example:

hr {
  border-top: 1px dotted #f00;
  color: #fff;
  background-color: #fff;
  height: 1px;
  width:50%;
}

See also Styling <hr> with CSS.

Sinan Ünür
Thanks,this is ok,and for putting width?
Kaveh
we can add e.g'width:50%;
Kaveh
As IE 6 (can't remember for IE7) won't understand the "dotted" style, you can tell him to use "dashed" instead, using of course conditional comments to aim IE6 and no other browser.
Felipe Alsacreations
A: 

This is best cross browser solution

http://divitodesign.com/css/css-1px-dotted-border-bug-in-internet-explorer-6/

metal-gear-solid
A: 

add following line to the element you want to have dotted line.

style="border-bottom: 1px dotted #ff0000;"

Sarfraz