开发者

css label and input question

I have the following css for my label and input:

label {
    display:block;
    font-weight:bold;
    color:#444;
    margin:5px 0;
}

label.notification {
    clear: both;
    color:#200;
    margin:5px 0;
}


input {
    width:300px;
    padding:4px;
    border:none;
    border-bottom:1px dotted #ccc;
    font:90% Verdana;
    color:#777;
}

I want it so that when I have a input and label notification in one line. How ca开发者_StackOverflow社区n I do this? currently it is always on a separate line.

This is how I will use it:

<label id="date">Date</label>
<input id="datepicker" name="datepicker"/></label>
<label class="notification">You need to enter a date</label>

datepicker and notification needs to be on the same line, but label (date) and datepicker needs to be on a different line


Get rid of the display: block in your CSS for label.

Edit:

As per your recent edit and comment. You just need to append a display: inline to your label.notification. As currently, it will inherit the display: block from the parent label styles, as the rules cascade down in CSS.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜