Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction to two practical attributes of CSS3

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "introduction to the two practical attributes of CSS3". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn the "introduction to the two practical attributes of CSS3"!

First, use: not () to apply / unapply borders on the menu

Our usual practice is to set a border for each menu item, and then set the border of the last menu to zero

/ * add border * / .nav li {border-right: 1px solid # 666;} / * remove border * / .nav li:last-child {border-right: none;} web front-end development Learning Q-q-u-n: 731771211, share learning methods and small details that need to be paid attention to, and constantly update the latest tutorials and learning methods (detailed front-end project practical teaching video, PDF)

But don't do this, use the: not () pseudo class to achieve the same effect:

.nav li:not (: last-child) {border-right: 1px solid # 666;}

Of course, you can also use .nav li + li or .nav li:first-child ~ li, but not () is clearer and readable

.nav li + li {border-left:1px solid # 666;} / * .nav li:first-child ~ li {border-left:1px solid # fff;} * / II. Use: nth-child (n) to select a project

(note: the subscript of the first child element is 1)

: nth-child (3) indicates the third element in the selection list

: nth-child (2n) represents an even number of tags in the list, that is, select 2nd, 4th, 6th. Label

: nth-child (2n-1) represents the odd tag in the selection list, that is, select 1st, 3rd, 5th, 7th... Label

: nth-child (nasty 3) indicates that the label in the selection list starts from the 3rd to the end (> = 3)

: nth-child (- naugh3) indicates that the tags in the selection list range from 0 to 3, that is, tags less than 3 (

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report