lexeme
lexeme

Reputation: 2973

Can't adjust label widths. JQuery

I have such a sketch: http://jsfiddle.net/challenger/upcZJ/.

I found an article http://www.jankoatwarpspeed.com/post/2008/07/09/Justify-elements-using-jQuery-and-CSS.aspx which explains how to adjust label widths relative to the widest one.

But I can't do the same. What have I missed? I've tried do the thing inside an accordion tab and inside aside division.

Thanks!

Upvotes: 1

Views: 2370

Answers (2)

U.P
U.P

Reputation: 7442

You forgot to add the CSS which was mentioned in the article

label, input[type="text"]{
    float:left;
    display:block;
}
label
{
    margin-right: 5px;
}
.field{
    width:100%;
    overflow:auto;
    margin:5px 0px;
}

Upvotes: 2

Quentin
Quentin

Reputation: 944474

Your label elements are display: inline (the default) so the width property does not apply.

Set display to something else (e.g. inline-block)

Upvotes: 3

Related Questions