Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't set font-weight on the :after pseudo-element used on <input> elements

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?

like image 790
koningdavid Avatar asked Aug 09 '13 15:08

koningdavid


1 Answers

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?

like image 195
Joshua5822 Avatar answered Oct 13 '22 23:10

Joshua5822