Html css 列表項 區分列表首尾

2022-02-13 05:22:54 字數 1503 閱讀 5540

列表項,有時需要判斷列表首尾,來篩選設定樣式

如上圖,三個項有間隔,怎麼保證設定了列表項之間的距離後,整體還水平居中顯示呢?

.item:not(:first-child)

1

doctype html

>

2<

html

>

3<

head

>

4<

meta

charset

="utf-8"

>

5<

title

>document

title

>

6<

style

type

="text/css"

>

7.container

12.list-parentouter

16.list-parentinner

24.item

35.item:not(:first-child)

38style

>

3940

head

>

41<

body

>

42<

body

>

43<

div

class

="container"

>

44<

div

class

="list-parentouter"

>

45<

div

class

="list-parentinner"

>

46<

div

class

="item"

>aaa

div>

47<

div

class

="item"

>bbb

div>

48<

div

class

="item"

>ccc

div>

49div

>

50div

>

51div

>

52body

>

53body

>

54html

>

view code

以上是css :first-child 選擇器的用法

:first-child 選擇器用於選取屬於其父元素的首個子元素的指定選擇器。

還有first-of-type、last-of-type、nth-of-type(2)、nth-last-of-type(2),以型別篩選第乙個元素。

更多元素選擇器,訪問 w3school

FreeRTOS筆記 列表和列表項

1.列表結構體 2.minilistitem t的結構體 3.列表項 4.列表初始化 1.列表初始化時,列表是空的,因此列表的pxindex是指向列表的尾的 2 3 4 初始化列表的xlistend 5 列表的列表項的數目為0 初始化完成功能以後,列表如下所示 5.初始化列表項 1.此列表項暫時不屬...

FreeRTOS列表與列表項分析

本部落格中部分,來自 freertos開發手冊 正點原子 列表與列表項是freertos中的之中的資料結構。列表的底層實際是使用鍊錶實現的。乙個簡單的列表與列表項如下圖 需要注意的是,列表並不是鍊錶,也不是列表項的集合,而是乙個結構體。列表的定義如下 typedef struct xlist lis...

FreeRTOS之列表與列表項

uxnumberofitems 記錄列表項的數量 pxindex 記錄當前列表項的索引號 xlistend 表示列表的結束 xitemvalue 列表項的值 pxnext 指向下乙個列表項 pxprevious 指向上乙個列表項 pvowner 記錄當前列表歸 誰 所有 pvcontainer 記錄...