6

So, i've got a custom style on an input element, and I want to place some text on the input with the use of :after.

The problem i'm running into is that i cannot seem to change the font-weight on the :after element, this problem only occurs with the combination of input and :after elements.

CSS

input[type="checkbox"] { /* enable styling of the checkbox ! */
    -moz-appearance: none;
    -webkit-appearance: none;
}

input { /* set up some basic styles.... */
    background-color:#ccc;
    width:200px;
    height:200px;
    background-color:grey;
}

input:after { /* and we create the :after element */
    width:100%;
    text-align:center;
    font-weight:100; /* THIS DOESN'T WORK FOR SOME REASON */
    content: "This should be thin"; /* some text */
}

JSFIDDLE

http://jsfiddle.net/xQVfL/1/

TESTED ON

Chrome for mac (latest)

QUESTION

Why can't I set font-weight on the :after element set on an input element?

James Donnelly
  • 126,410
  • 34
  • 208
  • 218
koningdavid
  • 7,903
  • 7
  • 35
  • 46

1 Answers1

2

This was answered here. It seems :after was intended for appending to container tags only. Can I use the :after pseudo-element on an input field?

Community
  • 1
  • 1
Joshua5822
  • 341
  • 2
  • 10
  • Well... that sucks. Gonna wait a little longer, maybe someone comes up with a workaround, else ill accept you answer. – koningdavid Aug 09 '13 at 15:21