Creating an input element with a dotted border

13,985

Solution 1

This is the code I came up with:

HTML

<input type="text" id="dotted">

CSS

#dotted {
    border:0;
    border-bottom: 2px dotted;
}

Here is a jsfiddle.

Solution 2

HTML:

<input type="text" class="dotted-input">​​​​​​​​​​​​​​​​​​​​​​

CSS:

.dotted-input {
    border: 0px; 
    border-bottom:1px dotted #000;
}​

Solution 3

Here's one

<input type="text" class="dotbox">​​​​​​​​​​​​​​​​​​​​​​
.dotbox{
    border:none;
    border-bottom:thin dashed black;
    padding-bottom:0;
    outline:none;
}

DEMO

Share:
13,985
murtaza52
Author by

murtaza52

I am a clojure enthusiast working out from Pune, India.

Updated on June 04, 2022

Comments

  • murtaza52
    murtaza52 almost 2 years

    I want to place an input element in a form. However, instead of it having a solid-box border, I want it to have a dotted border.

    This is similar to what basecamp has for inviting new people to existing projects. Basecamp project access

    Any ideas how to do that?

  • murtaza52
    murtaza52 over 11 years
    I am unable to get the above style working. I am using twitter bootstrap, could that be overriding the styles you have provided above ?
  • Sean Keating
    Sean Keating over 11 years
    It would be likely they would use this on multiple input fields, so a class would me more appropriate than an Id.
  • Shiridish
    Shiridish over 11 years
    Yes may be there is some CSS specificity issue there. Do you find the above css overridden with existing css in Firebug or developer tools?