inline 元素的特性

2022-01-28 22:39:51 字數 2746 閱讀 1706

inline不認高寬,不認上下的margin,不認overflow,但可以識別padding和左右方向的margin,也有line-height

inline屬性的a標籤,span標籤支援margin-left與margin-right,margin-top無作用,而img標籤margin四個方向都支援()。

本文章介紹了inline元素的padding,margin,width,height對元素本身的影響

要點:塊狀元素前後元素會換行

行內元素前後元素不會換行

第一:行內元素與寬度

寬度不起作用

span 沒有變化

第二:行內元素與高度

高度不起作用  但是高度可有line-height來確定

span

沒用變化

第三:行內元素與padding,margin

span

影響左右,不影響上下

如何實現

中的li在同一行顯示並有上下邊距呢,

如果用display:inline,可行讓其在一行內顯示,但上下padding不起作用。

所以這種情況下用float:left;使其在一行內顯示,並且其還是block元素,可以用

padding使與上下padding起作用,差生一定距離

li 的padding和margin都正常生效  li是塊級元素

examples of block level elements

element

description

information on author

long quotation

push button

table caption

definition description

deleted text

generic language/style container

definition list

definition term

form control group

interactive form

heading

heading

heading

heading

heading

heading

horizontal rule

inline subwindow

inserted text

fieldset legend

list item

client-side image map

alternate content container for non frame-based rendering

alternate content container for non script-based rendering

generic embedded object

ordered list

paragraph

preformatted text

table

table body

table data cell

table footer

table header cell

table header

table row

unordered list

inline 行內 元素

兩者之前的轉換 用到語句 display inline block 2.css對文字的控制 接下來,我們討論 text decoration 屬性,這是乙個很有意思的屬性,它提供了很多非常有趣的行為。text decoration 有 5 個值 text transform 屬性處理文字的大小寫。這...

block 塊元素 inline 內聯元素

我們首先要了解,所有的html元素,都要麼是block 塊元素 要麼是inline 內聯元素 下面了解一下block inline各自的特點 block元素的特點 總是在新行上開始 高度,行高以及頂和底邊距都可控制 寬度預設是它的容器的100 除非設定乙個寬度。塊元素 block element 一...

C C 中inline內聯函式的特性

相當於把內聯函式裡面的內容寫在呼叫內聯函式處 相當於不用執行進入函式的步驟,直接執行函式體 相當於巨集,卻比巨集多了型別檢查,真正具有函式特性 不能包含迴圈 遞迴 switch 等複雜操作 類中除了虛函式的其他函式都會自動隱式地當成內聯函式 將 inline 函式體複製到 inline 函式呼叫點處...