2nd line text off to other side (CSS)
In the above image I have a field on my form. I would like the text to sit within the area highlighted in red.
I have currently set the following in the CSS for the field.
.checkbox-text{
width:开发者_运维技巧 300px;
height: 50px;
margin-left: 7px;
}
What do I need to do?
Thanks
CSS width
and height
only work when the element is in block mode, not inline, which is the default for most text elements.
But you still need it to be inline as well, so that it keeps to its current position in the page flow.
Therefore you need inline-block mode. You can add this to your stylesheet like this:
.checkbox-text{
display:inline-block;
}
Now your height
and width
properties will work.
Hope that helps.
My guess is that the element with the class checkbox-text
is an inline elements, to which width
doesn't apply. Add display: block
.
And next time, please, show your HTML.
精彩评论