林新在這個編程世界的一列,我想/需要了解與圖像 Image of description如何創建具有圖像和文本的HTML和CSS
-2
A
回答
0
#header{
width:100%;
text-align:center;
padding:10px;
font-size:30px;
}
#Title{
width:100%;
text-align:center;
padding:10px;
font-size:15px;
}
#row{
width:100%;
text-align:center;
padding:5px;
}
.col{
width:25%;
height:100px;
text-align:center;
padding:5px;
margin:2px;
border:1px solid gray;
display:inline-block;
}
<div id="header"><span>test header</span></div>
<div id="Title">test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test </div>
<div id="row">
<div class="col"> </div>
<div class="col"> </div>
<div class="col"> </div>
</div>
+0
爲什麼內聯塊而不是表格單元格,網格或flex? ;) –
0
創建此列
我能想到6種經典的在文檔流中繪製列的方法。
每次用不同的行爲或副作用,可能是頭腦: (邊界和BG是以示區別)pen to play with
/* reset and commun styling */
* {
box-sizing: border-box;
text-align:center;
}
.row {
width: 80%;
margin: 2em auto;
border: solid;
counter-reset: div;
position: relative;
}
.row:after {
content: attr(class);
position: absolute;
bottom: 100%;
border: solid;
left: 0;
background: yellow;
font-size:1rem;
}
.row > div:before {
counter-increment: div;
content: counter(div);
}
.row :nth-child(2) {
border: solid;
border-width: 0 3px 0 3px;
/* shows behavior of sibblings */
padding: 1em 0;
}
.row div {
background: gray;
}
/* float and side effect cured */
.row.float {
display:table;/*instead overflow to trigger BFC*/
/* overflow:hidden ; removed to show classname */
}
.row.float div {
float: left;
width: 33.33%;
}
/* inline-block and side effect cured */
.row.inline-block {
font-size: 0;
}
.row.inline-block div {
font-size: 1rem;
display: inline-block;
width: 33.33%;
}
/* table and setting*/
.row.table {
display: table;
border-spacing: 0;
}
.row.table div {
display: table-cell;
width: 33.33%;
}
/* multiple column CSS , reset styling*/
.row.column {
column-count:3;
column-rule: inset 3px ;
column-fill:balance;
background:gray;
}
.row.column div {
background:lightgray;
border:none;
border-bottom:solid white;/* see my behavior */
}
/* flex-ible */
.row.flex {
display: flex;
}
.row.flex div {
flex: 1;
}
/* grid and grid setting */
.row.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
}
<div class="row float">
<div></div>
<div></div>
<div></div>
</div>
<div class="row inline-block">
<div></div>
<div></div>
<div></div>
</div>
<div class="row table">
<div></div>
<div></div>
<div></div>
</div>
<div class="row column">
<div></div>
<div></div>
<div></div>
</div>
<div class="row flex">
<div></div>
<div></div>
<div></div>
</div>
<div class="row grid">
<div></div>
<div></div>
<div></div>
</div>
與浮體和內聯塊您還可以使用人造色譜柱技術:https://alistapart.com/article/fauxcolumns(注意它仍然是多麼老和堅實)
相關問題
- 1. 使用CSS和HTML創建Sprite圖像
- 2. 需要從HTML創建具有文本,圖像和項目符號的PDF
- 3. 只有css和html的圖像上的文本
- 4. 如何使用html和css垂直創建文本?
- 5. 的Javascript HTML如何創建帶有多用戶(圖標和文本)文本框
- 6. 如何創建圖像標題和圖像疊加與CSS?
- 7. 用HTML 5和CSS 3創建「截圖」?
- 8. CSS和javascript文本和圖像定位
- 9. 電子書html和css對齊圖像和文本
- 10. 使用CSS和HTML定位文本和圖像
- 11. 如何製作具有圖像和文本菜單的NSPopupButton?
- 12. 如何創建鏈接到Rails 3中的文本和圖像?
- 13. 如何用Xamarin中的文本和圖像創建ListView?
- 14. 在創建CSS和HTML背景只有
- 15. HTML/CSS填充和圖像
- 16. 重複圖像HTML和CSS
- 17. 鏈接html css和圖像
- 18. 使用asp.net中的文本和圖像隨時創建圖像
- 19. CSS和HTML重疊的圖像創建負空間..如何刪除neg空間?
- 20. 使用PHP從HTML和CSS創建圖像
- 21. 如何用圖像,文本和兩種顏色創建按鈕?
- 22. 如何創建AppWidget來顯示JSON解析圖像和文本
- 23. CSS:如何添加具有邊框和無圖像的圓角?
- 24. 如何使用Rails的css和圖像創建電子郵件?
- 25. 創建具有圖像
- 26. 使用HTML和CSS浮動圖像列表項的文本?
- 27. 在HTML和CSS中,我該如何正確創建日文文本斷行?
- 28. 如何根據截圖使用html和css創建表格
- 29. 如何使用CSS和HTML創建水平樹視圖?
- 30. 使用javascript創建具有本地圖像的圖像對象
歡迎來到SO。請發佈您嘗試過的相關代碼 - 不包括代碼圖片 - 以及明確的問題陳述。 – jmargolisvt
[本網站](https://www.google.com/)使得它非常容易找到編程資源,我強烈推薦它 –
您回答了您自己的問題:_with HTML和CSS_。 StackOverflow不是一個代碼寫入服務。請盡力而爲,當遇到問題時,請閱讀[this](https://stackoverflow.com/help/mcve)並更新您的問題。 – chazsolo