簡體   English   中英

如何使用CSS創建此(表)

[英]How can I create this (table) with CSS

我想使用CSS創建此設計。 在較小的屏幕上,紅色文本/區域(響應)應該是響應/靈活的。

我要使用CSS創建的設計: 在此處輸入圖片說明

我可以使用html-table來簡化它,但是在設計中不應該使用表。

我查看了無序列表,並隱藏了項目符號,並替換為圖像,但是內容和響應區域之間的規范存在問題。

這是一些代碼,但是當我在facebook和twitter按鈕的右側添加文本時,我無法正常工作。

<div id="fact-footer">
<img id="img-fb" src="img/fb.svg" alt="Facebook">
<img id="img-fb" src="img/tw.svg" alt="Facebook">
<a id="more-facts" href="#">NÄSTA ></a>
</div>


#fact-footer {
bottom: 0;
font-size: 12px;
}

#img-fb, #img-twitter {
float: left;    
width: 35px;
height: 35px;
}

#img-fb {
margin-right: 10px;
}

#more-facts {
float: right;
font-size: 14px;
padding: 8px;
border: none;
border-radius: 2px;
box-shadow: 0px 1px 3px rgba(0,0,0,0.3);
cursor: pointer;
background-color: #26a69a;
color: white;
}

代碼原本導致

在此處輸入圖片說明

您是否期望這樣:

 body{ margin:10px; } .flex-container { padding: 0; margin: 0; list-style: none; -ms-box-orient: horizontal; display: -webkit-box; display: -moz-box; box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2); display: -ms-flexbox; display: -moz-flex; display: -webkit-flex; display: flex; -webkit-justify-content: space-around; justify-content: space-around; -webkit-flex-flow: row wrap; flex-flow: row wrap; -webkit-align-items: stretch; align-items: stretch; } span{ color:black; } .flex-item:nth-of-type(5) { flex-grow: 1; } .flex-item { background: #e0e0e0; color: white; padding:6px; font-weight: bold; font-size: 1em; text-align: center; } .btn{ background-color: #5fda64; /* Green */ border: none; color: white; box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2); padding: 10px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; border-radius:5px; cursor: pointer; } 
 <script src="https://use.fontawesome.com/ecdc7512a9.js"></script> <ul class="flex-container"> <li class="flex-item"> <i style="color:blue" class="fa fa-facebook fa-3x"></i> </li> <li class="flex-item" > <span > facebook <br/> Account </span> </li> <li class="flex-item"><i style="color:lightblue" class="fa fa-twitter fa-3x"></i> </li> <li class="flex-item"> <span>Twitter <br/> Account </span> </li> <li class="flex-item">(responsive)</li> <li class="flex-item"> <button class="btn">NASTA ></button> </li> </ul> 

使用flex您可以使用它

<div class="row">
  <div class="col-sm-3"> facebook image here </div>
  <div class="col-sm-3"> twiter image here </div>
  <div class="col-sm-3"> text </div>
  <div class="col-sm-3"> nasta image here </div>
</div>

.row {
  width: 100%;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  box-sizing: border-box;
}
.col-sm-3 {
  width: 25%;
  -ms-flex: 0 0 25%;
  flex: 0 0 25%;
  box-sizing: border-box;
}

.col-sm-3一個邊框,看看會發生什么(並且您在使用Bootstap而不使用完整的軟件包)。

使用bootstrap https://getbootstrap.com/

您可以使用四行一列

<div class="row">

<div class="col-sm-3"> facebook image here </div>
    <div class="col-sm-3"> twiter image here </div>
    <div class="col-sm-3"> text </div>
    <div class="col-sm-3"> nasta image here </div>
</div>

我該如何模仿“<div id="text_translate"><p> 我正在使用 ExtJS 編寫 web 應用程序。 我將一個表放在一個表中,由於各種原因,不可能將它全部重構為一個帶有行跨度/列跨度等的大表。</p><p> “外部”表格的單元格周圍有邊框。 我希望我的“內部”表格在其單元格<em>之間</em>有邊界,這樣我就可以得到“拆分”現有(“外部”)單元格的效果。</p><p> 如果它讓事情變得更清楚,這就是我所追求的,作為(糟糕的)ascii藝術:</p><pre> ----------------- | | | | | | | ----------- | | | | | | ----------- | | | | | | | -----------------</pre><p> (“內”表看起來像井字游戲網格;“外”表的單元格有一個完整的邊框)</p><p> 我環顧四周,發現了一個名為RULES的&lt;table&gt;屬性,聽起來它就是這樣做的。 但是,它似乎沒有得到很好的支持,無論如何我不應該將樣式放在標記中(對嗎?)。 我發現的文檔說“使用 CSS 代替”,但我似乎無法在 CSS 中找到一種簡單的方式來表達“在單元格之間設置邊框,但如果單元格的邊緣接觸到表格的外部則不行” . 幫助?</p></div>” 與 CSS?<table rules> </table>

[英]How can I emulate “<TABLE RULES>” with CSS?

暫無
暫無

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

相關問題 如何創建像這個 excel 表這樣的 html css 表 如何使用CSS創建可滾動的HTML表列? 如何為表格創建CSS布局,使其可以在移動設備,平板電腦和台式機上使用 如何僅使用CSS創建此效果? 如何創建波浪形 CSS? 如何使用CSS創建傾斜的頁腳? 如何使用 JavaScript 創建 CSS 變量? 如何包裝表(CSS) 我該如何模仿“<div id="text_translate"><p> 我正在使用 ExtJS 編寫 web 應用程序。 我將一個表放在一個表中,由於各種原因,不可能將它全部重構為一個帶有行跨度/列跨度等的大表。</p><p> “外部”表格的單元格周圍有邊框。 我希望我的“內部”表格在其單元格<em>之間</em>有邊界,這樣我就可以得到“拆分”現有(“外部”)單元格的效果。</p><p> 如果它讓事情變得更清楚,這就是我所追求的,作為(糟糕的)ascii藝術:</p><pre> ----------------- | | | | | | | ----------- | | | | | | ----------- | | | | | | | -----------------</pre><p> (“內”表看起來像井字游戲網格;“外”表的單元格有一個完整的邊框)</p><p> 我環顧四周,發現了一個名為RULES的&lt;table&gt;屬性,聽起來它就是這樣做的。 但是,它似乎沒有得到很好的支持,無論如何我不應該將樣式放在標記中(對嗎?)。 我發現的文檔說“使用 CSS 代替”,但我似乎無法在 CSS 中找到一種簡單的方式來表達“在單元格之間設置邊框,但如果單元格的邊緣接觸到表格的外部則不行” . 幫助?</p></div>” 與 CSS?<table rules> </table> 如何使用CSS導航創建子菜單?
 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM