日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 前端技术 > CSS >内容正文

CSS

在CSS中使用not:first-child选择器

發(fā)布時(shí)間:2025/3/11 CSS 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 在CSS中使用not:first-child选择器 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Introduction:

介紹:

Well, selectors are a very common term to deal with while we are developing a website or web page. You might know quite a few of them and might as well be implementing them. You might also have noticed that all the selectors are used for selecting some element or other, well that's their entire purpose and thus the name selectors. Although all the selectors share common characteristics but not all of them are the same. Their behaviors differ to a very great extent and one can only know after practical implementation. So, since we are discussing selectors, why don't we talk about one very specific selector? Although you might have come across this selector at some point of your time. The selector we will be focused on is not:first-child selector. To know more about this selector just keep reading on!

好吧,在我們開發(fā)網(wǎng)站或網(wǎng)頁時(shí),選擇器是一個(gè)很常見的術(shù)語。 您可能知道很多,也可能正在實(shí)施它們。 您可能還已經(jīng)注意到,所有選擇器都用于選擇某些元素或其他元素,這就是它們的全部用途,因此也就是名稱選擇器。 盡管所有選擇器都具有共同的特征,但并非所有選擇器都相同。 它們的行為差異很大,只有在實(shí)際實(shí)施后才能知道。 因此,既然我們正在討論選擇器,為什么不談?wù)撘粋€(gè)非常具體的選擇器呢? 盡管您可能在某個(gè)時(shí)候遇到了此選擇器。 我們將關(guān)注的選擇器不是:first-child選擇器 。 要了解有關(guān)此選擇器的更多信息,請(qǐng)繼續(xù)閱讀!

Well, the name sounds a bit weird, doesn't it? Not: first child. So, that brings us to the question of what does this selector does and how is this selector different from other selectors. Well, the functioning and behavior of this selector are not very tough to understand and you can easily figure out from the name itself that for what purpose this selector is put to use. So let us look at a more formal definition of this selector so that we get a better gist of it.

好吧,這個(gè)名字聽起來有些怪異,不是嗎? 不:第一個(gè)孩子。 因此,這就引出了這個(gè)選擇器的作用以及該選擇器與其他選擇器有何不同的問題。 好吧,這個(gè)選擇器的功能和行為并不是很難理解的,您可以很容易地從名稱本身中得知該選擇器用于什么目的。 因此,讓我們看一下這個(gè)選擇器的更正式定義,以便我們更好地了解它。

Definition:

定義:

The not:first-child selector as the name suggests is used to select every element which is not the first child element of it's deriving parent element. Pretty simple right? The selector is not used for choosing the first child of its parent element. This selector is usually represented as an argument and it is seen in the form of not(first-child). To help you understand this in a better way, why don't you go ahead and have a look at the syntax below,

顧名思義, not:first-child選擇器用于選擇不是其派生父元素的第一個(gè)子元素的每個(gè)元素。 很簡單吧? 選擇器不用于選擇其父元素的第一個(gè)子元素。 該選擇器通常表示為一個(gè)參數(shù),并且以not(first-child)的形式出現(xiàn)。 為了幫助您更好地理解這一點(diǎn),為什么不繼續(xù)閱讀下面的語法,

:not(element){//some CSS property}

Example:

例:

In the above example the div element contains <ul> elements, so it selects all child elements of <div> tag except its first-child and applies the CSS styles.

在上面的示例中,div元素包含<ul>元素,因此它將選擇<div>標(biāo)記的所有子元素(第一個(gè)孩子除外)并應(yīng)用CSS樣式。

Piece of advice:

一點(diǎn)建議:

Now, it is time to make use of your new-found knowledge. But before you get on with that make sure you use this selector properly wherever required because you don't want your code to get ruined just because of a silly mistake right? Not just this one you must use every selector wisely to make your website or web page responsive and whenever in doubt, you will always have this article for your reference. Also, if you have some issues with our code and practice, we are always available to help you at https://ask.includehelp.com/.

現(xiàn)在,該利用您新發(fā)現(xiàn)的知識(shí)了。 但是在繼續(xù)之前,請(qǐng)確保在所需的任何地方正確使用此選擇器,因?yàn)槟幌M麅H僅因?yàn)橐粋€(gè)愚蠢的錯(cuò)誤而導(dǎo)致代碼被破壞嗎? 您不僅必須明智地使用每個(gè)選擇器,以使您的網(wǎng)站或網(wǎng)頁具有響應(yīng)能力,而且如有疑問,您將始終可以將本文作為參考。 另外,如果您對(duì)我們的代碼和實(shí)踐有任何疑問,請(qǐng)?jiān)L問https://ask.includehelp.com/隨時(shí)可以為您提供幫助。

翻譯自: https://www.includehelp.com/code-snippets/using-a-not-first-child-selector-in-css.aspx

總結(jié)

以上是生活随笔為你收集整理的在CSS中使用not:first-child选择器的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。