久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

CSS動態(tài)水平導(dǎo)航菜單填充特定寬度(表格行為)

CSS dynamic horizontal navigation menu to fill up specific width (table behavior)(CSS動態(tài)水平導(dǎo)航菜單填充特定寬度(表格行為))
本文介紹了CSS動態(tài)水平導(dǎo)航菜單填充特定寬度(表格行為)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我需要創(chuàng)建一個水平導(dǎo)航菜單,其中包含不斷變化的項目數(shù)量(這很重要 - 我不能將寬度硬編碼到 CSS 中,我不想用 JS 計算它們)填充到一定的寬度,比如 800px.

I need to create a horizontal navigation menu with a changing number of items (this is important - I can't hard-code widths into the CSS and I don't want to calculate them with JS) that fill up to a certain width, let's say 800px.

對于表格,

<table width="800" cellspacing="0" cellpadding="0">
  <tr>
    <td>One</td>
    <td>Two</td>
    <td>Three</td>
    <td>Four</td>
    <td>Five Seven</td>
  </tr>
</table>

<style>
table td {
      padding: 5px 0;
      margin: 0;
      background: #fdd;
      border: 1px solid #f00;
      text-align: center;
    }
</style>

請注意,較長的項目會占用更多空間,我可以在不更改 CSS 中的任何內(nèi)容的情況下將項目添加到 HTML 中,并且菜單項會縮小以容納額外的項目 - 整個菜單永遠不會短于或長于 800 像素.

Note that longer items take up more space and I can add items into the HTML without changing anything in CSS and the menu items shrink to accommodate additional items - the whole menu never being shorter or longer than 800px.

由于菜單在語義上不是對表格的正確使用,因此可以通過列表和純 CSS 來實現(xiàn)嗎?

As a menu isn't a semantically correct use of a table, can this be done with say a list and pure CSS?

推薦答案

在支持表格的瀏覽器中顯示 CSS規(guī)則,是的:

In browsers that support the table display CSS rules, yes:

<style>
  nav {display:table; width:800px; background:yellow}
  ul {display:table-row; }
  li {display:table-cell; border:1px solid red}
</style>

<nav>
 <ul>
  <li>One</li>
  <li>Two</li>
  <li>Three</li>
  <li>Four</li>
  <li>Five Seven</li>
 </ul>
</nav>

基本上,您必須構(gòu)建一個令牌表.實際操作:http://jsbin.com/urisa4

Basically, you'd have to build a token table. In action: http://jsbin.com/urisa4

否則:不,如果你不能妥協(xié)你的要求.

Otherwise: no, not if you can't compromise your requirements.

這篇關(guān)于CSS動態(tài)水平導(dǎo)航菜單填充特定寬度(表格行為)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to check for duplicate CSS rules?(如何檢查重復(fù)的 CSS 規(guī)則?)
Remove duplicate CSS declarations across multiple files(刪除多個文件中的重復(fù) CSS 聲明)
How can I duplicate a div onclick event?(如何復(fù)制 div onclick 事件?)
opening html from google drive(從谷歌驅(qū)動器打開 html)
How to embed videos from Google drive to webpage?(如何將視頻從 Google 驅(qū)動器嵌入到網(wǎng)頁?)
How to view Google drive pdf link in iframe(如何在 iframe 中查看 Google Drive pdf 鏈接)
主站蜘蛛池模板: 久久久久亚洲精品 | av中文在线观看 | 国产久| 精品九九九 | 日韩激情一区 | 91成人| 91九色婷婷 | 欧美一区二区三区在线观看 | 97福利在线 | 日韩欧美国产一区二区 | 99精品久久99久久久久 | 欧美日韩高清 | 性色av香蕉一区二区 | 欧美区在线观看 | 一区二区精品在线 | 国产区一区二区三区 | 999热在线视频 | 日本一区二区三区四区 | 日韩视频专区 | 一区二区三区免费 | 免费一区 | 成人性生交a做片 | 国产精品久久久久久久久久免费 | 中文精品视频 | 亚洲精品视频一区二区三区 | 日韩三级在线观看 | 最近中文字幕在线视频1 | 亚洲成人一区二区 | 欧美一级免费片 | 黄色一级视频 | 国产成人精品一区二区 | 国产成人精品一区二区三区在线 | 91久久电影 | 亚洲成人黄色 | 另类在线 | 一区二区三区中文字幕 | 国产精品一区久久久 | 日韩中文字幕视频在线观看 | 欧美激情在线一区二区三区 | 巨大荫蒂视频欧美另类大 | 黄色成人在线网站 |