English 中文(简体)
以 CSS 格式排列一排标签并下调列表
原标题:Styling a row of labels and drop down lists with CSS

如何排列一行的标签/从列表中删除列表的样式, 但是, 每一个下降列表上方都有标签 。

目前我的HTML里有:

<label for="select1">Label1</label>
<select id="select1">...<select>

<label for="select2">Label2</label>
<select id="select1">...<select>

<label for="select3">Label3</label>
<select id="select3">...<select>

By default, they all line up in one row. If I apply this style

label {
display:block;
}

我把他们都排成一列, 由于缺乏更好的词。

那么,我如何用风格来描述它们,让一排的标签/删除列表,但是,每个下降列表上方都有标签?当然没有表格。

最佳回答
问题回答

您可能不得不将 label select 归类在另一个标签中,如 p , div fieldset ,然后使该元素成为 display: inline- block float: lft

检查此页面顶部的菜单( 问题、 标签、 用户、...) 。 它与一个未排序的列表组合在一起 。

<div class="nav mainnavs">
    <ul>
        <li class="youarehere"><a id="nav-questions" href="/questions">Questions</a></li>
        <li><a id="nav-tags" href="/tags">Tags</a></li>
        <li><a id="nav-users" href="/users">Users</a></li>
        <li><a id="nav-badges" href="/badges">Badges</a></li>
        <li><a id="nav-unanswered" href="/unanswered">Unanswered</a></li>
    </ul>
</div>

您可以将每对标签/下调配对都插入列表项 。

<li>
    <label for="select1">Label1</label>
    <br />
    <select id="select1">...<select>
</li>

最后,我把这些放在桌子上,因为我有几个排子,他们都得排成一排。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签