Reputation: 9362
How can I define a width for the label Quantity (see below)? I would like a CSS solution without defining a style on the span but directly on the label.
Something like:
span label[for=Quantity]
{
width: 200px;
}
But the above css doesn't work.
Upvotes: 1
Views: 99
Reputation: 751
you can make label a block element and set float to left so you can put other controls next to it
label {
display: block;
float: left;
width: 180px;
}
Upvotes: 0
Reputation: 1909
using the inline-block is better because it doesn't force the remaining elements and/or controls to be drawn in a new line
.label {
width:200px;
display: inline-block;
}
Upvotes: 0
Reputation: 551
Your adding width to an inline element they wont accept that.
span label[for=Quantity]
{
width: 200px;
display: block;
}
Upvotes: 5