I have a element (e.g. a label) with a fixed width and I want that only the text to be dotted-underlined. If a do the "trick" with border-bottom the whole box will be underlined
I think this explains my problem
I have a element (e.g. a label) with a fixed width and I want that only the text to be dotted-underlined. If a do the "trick" with border-bottom the whole box will be underlined
I think this explains my problem
You should wrap it into a span and add that border-bottom style to that span: http://jsfiddle.net/mrg9a/2/
You could wrap the text in <span>
tags and then apply the style to the spans.
See the second element in this jsFiddle example.
Since
label
elements are inline by default, the problem is caused by making them inline blocks. This in turn is presumably an attempt to avoid using the most natural and most effective way of structuring a form, namely an HTML table. Just switch totable
markup and uselabel
insidetd
with no fancy settings, and thelabel
elements will take the border you set on them, in their natural width.