簡體   English   中英

如何在同一行中對齊span和html下拉列表?

[英]How to align the span and html dropdown in same line?

我設計的用戶界面如下所示。

<div class="rightbadger">
    <span id="filterRecords">
        Number of Results Per Page
        <%:Html.DropDownList(
            "filterByPageNumber", 
            Model.ResultPerPage,
            null,
            new { onchange = "GetResultsPerPage()" }
        )
        %>
    </span>
</div>

CSS:

.rightbadger { margin-left: 600px;}

但是跨度和下拉列表在同一行中排列不正確。在某些瀏覽器中看起來不錯,但在某些瀏覽器中顯示如下所示。 以下是圖片的屏幕截圖

只需把CSS

.filterRecords select{
    display:block;
}

如果要垂直對齊它們,則可能應將文本放在單獨的元素中,如下所示:

<div class="rightbadger">
    <div id="filterRecords">
        <span>Number of Results Per Page</span>
        <%:Html.DropDownList(
            "filterByPageNumber", 
            Model.ResultPerPage,
            null,
            new { onchange = "GetResultsPerPage()" }
        )
        %>
    </div>
</div>

然后垂直對齊2元素,如您所願:

#filterRecords span,
#filterRecords select{ /*or just '#filterRecords *' */
    vertical-align: bottom; /*or middle; or top; */
}

您必須設置跨度和下拉列表:

float:left;
width:300px;
display:block;

如何使用自定義 html 下拉菜單<div><span></span></div><div id="text_translate"><p>我正在嘗試創建一個定價表來展示基於購買條款(每月、每年、三年一次)的服務定價。</p><p> 從下拉列表中選擇一個選項會使用 javascript 更改鏈接屬性,這正是我想要的,但是,下拉選項的實際樣式似乎相當困難。</p><p> 試圖在沒有任何可行解決方案的情況下連續數小時實現這一目標。</p><p> 附件是我想要實現的目標的圖像。</p><p> <a href="https://i.stack.imgur.com/afsZC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/afsZC.png" alt="在此處輸入圖像描述"></a></p><p> 有誰知道我做錯了什么?</p><pre> &lt;div class="ive-hpbox"&gt; &lt;h3&gt;Simple Price Box&lt;/h3&gt; &lt;div class="dropdown-plans"&gt; &lt;select id="dynamic_select"&gt; &lt;option value="cart.php?a=add&amp;pid=1548&amp;billingcycle=monthly"&gt; &lt;h3&gt;Monthly&lt;/h3&gt; &lt;span class="hp-price"&gt;$12.00/mo&lt;/span&gt; &lt;/option&gt; &lt;option value="cart.php?a=add&amp;pid=1548&amp;billingcycle=annually" selected&gt; &lt;h3&gt;SAVE 50%&lt;/h3&gt; &lt;span class="hp-disc-price"&gt;1 Year at &lt;strike&gt;$144.00/mo&lt;/strike&gt;&lt;/span&gt; &lt;span class="hp-price"&gt;$72.00/mo&lt;/span&gt; &lt;/option&gt; &lt;option value="cart.php?a=add&amp;pid=1548&amp;billingcycle=triennially"&gt; &lt;h3&gt;SAVE 70%&lt;/h3&gt; &lt;span class="hp-disc-price"&gt;3 Year at &lt;strike&gt;$432.00/mo&lt;/strike&gt;&lt;/span&gt; &lt;span class="hp-price"&gt;$129.60/mo&lt;/span&gt; &lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;p class="hecont act"&gt;Attractive selling introduction to the plan followed by an unordered list. &lt;strong&gt;Save huge&lt;/strong&gt; with a pro-plan.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; Disk Storage Space&lt;/li&gt; &lt;li&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; Accounts&lt;/li&gt; &lt;li&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; Antivirus Filtering&lt;/li&gt; &lt;li&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; Anti-spam Filtering&lt;/li&gt; &lt;li&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; Auto Responders&lt;/li&gt; &lt;li&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; IMAP / POP3 Protocols&lt;/li&gt; &lt;li&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; Control Panel&lt;/li&gt; &lt;/ul&gt; &lt;a class="but_small1" href="#features"&gt;View Features&lt;/a&gt; &lt;a id="order-btn"&gt; Order now &lt;/a&gt; &lt;/div&gt; document.getElementById("dynamic_select").onclick = function() { document.getElementById("order-btn"):href = "https.//example.com/"+this;value+"/". }:ive-hpbox{ width;350px: border;1px solid #a1a1a1: border-radius.;25em: padding;10px: text-align;center. }:ive-hpbox:hover{ box-shadow,0 0 10px rgba(0,0,0.;15). } #dynamic_select option:hp-saving { font-size;26px: } #dynamic_select { border; 1px solid #a1a1a1: padding;10px: text-align;center: background;#fff: width;90%. }:ive-hpbox ul{ display;block: text-align;left; }</pre><p> <a href="https://jsfiddle.net/6rsgnmdy/52/" rel="nofollow noreferrer">https://jsfiddle.net/6rsgnmdy/52/</a></p></div>

[英]How to customize an html dropdown menu using <div><span>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

相關問題 如何將高圖甜甜圈圖中心的HTML跨度與響應式設計對齊? HTML 對齊下拉元素 高圖-如何在同一條線上對齊兩個圖表 如何使用自定義 html 下拉菜單<div><span></span></div><div id="text_translate"><p>我正在嘗試創建一個定價表來展示基於購買條款(每月、每年、三年一次)的服務定價。</p><p> 從下拉列表中選擇一個選項會使用 javascript 更改鏈接屬性,這正是我想要的,但是,下拉選項的實際樣式似乎相當困難。</p><p> 試圖在沒有任何可行解決方案的情況下連續數小時實現這一目標。</p><p> 附件是我想要實現的目標的圖像。</p><p> <a href="https://i.stack.imgur.com/afsZC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/afsZC.png" alt="在此處輸入圖像描述"></a></p><p> 有誰知道我做錯了什么?</p><pre> &lt;div class="ive-hpbox"&gt; &lt;h3&gt;Simple Price Box&lt;/h3&gt; &lt;div class="dropdown-plans"&gt; &lt;select id="dynamic_select"&gt; &lt;option value="cart.php?a=add&amp;pid=1548&amp;billingcycle=monthly"&gt; &lt;h3&gt;Monthly&lt;/h3&gt; &lt;span class="hp-price"&gt;$12.00/mo&lt;/span&gt; &lt;/option&gt; &lt;option value="cart.php?a=add&amp;pid=1548&amp;billingcycle=annually" selected&gt; &lt;h3&gt;SAVE 50%&lt;/h3&gt; &lt;span class="hp-disc-price"&gt;1 Year at &lt;strike&gt;$144.00/mo&lt;/strike&gt;&lt;/span&gt; &lt;span class="hp-price"&gt;$72.00/mo&lt;/span&gt; &lt;/option&gt; &lt;option value="cart.php?a=add&amp;pid=1548&amp;billingcycle=triennially"&gt; &lt;h3&gt;SAVE 70%&lt;/h3&gt; &lt;span class="hp-disc-price"&gt;3 Year at &lt;strike&gt;$432.00/mo&lt;/strike&gt;&lt;/span&gt; &lt;span class="hp-price"&gt;$129.60/mo&lt;/span&gt; &lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;p class="hecont act"&gt;Attractive selling introduction to the plan followed by an unordered list. &lt;strong&gt;Save huge&lt;/strong&gt; with a pro-plan.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; Disk Storage Space&lt;/li&gt; &lt;li&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; Accounts&lt;/li&gt; &lt;li&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; Antivirus Filtering&lt;/li&gt; &lt;li&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; Anti-spam Filtering&lt;/li&gt; &lt;li&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; Auto Responders&lt;/li&gt; &lt;li&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; IMAP / POP3 Protocols&lt;/li&gt; &lt;li&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; Control Panel&lt;/li&gt; &lt;/ul&gt; &lt;a class="but_small1" href="#features"&gt;View Features&lt;/a&gt; &lt;a id="order-btn"&gt; Order now &lt;/a&gt; &lt;/div&gt; document.getElementById("dynamic_select").onclick = function() { document.getElementById("order-btn"):href = "https.//example.com/"+this;value+"/". }:ive-hpbox{ width;350px: border;1px solid #a1a1a1: border-radius.;25em: padding;10px: text-align;center. }:ive-hpbox:hover{ box-shadow,0 0 10px rgba(0,0,0.;15). } #dynamic_select option:hp-saving { font-size;26px: } #dynamic_select { border; 1px solid #a1a1a1: padding;10px: text-align;center: background;#fff: width;90%. }:ive-hpbox ul{ display;block: text-align;left; }</pre><p> <a href="https://jsfiddle.net/6rsgnmdy/52/" rel="nofollow noreferrer">https://jsfiddle.net/6rsgnmdy/52/</a></p></div> 將div對准同一行 如何使提交按鈕在 html 中“打印”內容,並在與 a 相同的行中輸入寬度為 100% 的文本<span>,</span><p> <span>, 或者</span><div> <span>?</span> 如何對齊列表下拉列表 HTML-如何插入 <span></span> 標記到每行 <pre></pre> 塊沒有硬編碼? html表跨度,如果數據相同 如何將標簽和輸入對齊在右側的同一行?
 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM