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

What is the css selector and the three ways to introduce it

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

Share

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

This article mainly explains "css selector and what are the three ways to introduce", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "css selector and what are the three introduction methods"!

CSS Foundation 1. What is CSS?

CSS is a cascading style sheet

CSS terminology markup language, no logic

CSS helps to style and layout web content

2. Three ways to introduce CSS 1. inline

Writing position: define a style tag within the head tag

CSS Syntax:css selector {style1; style2}

Advantages and disadvantages: readable, reusable, style bound by html pages, can not be provided to other html pages to use

2. Outreach

Writing location: in external css file, in html file through link tag to introduce css file

CSS syntax within CCS file:css selector {Style 1; Style 2}

HTML file import CSS file syntax:

Advantages and disadvantages: readable, reusable, suitable for team development (file-level reusability)

3. interline formula

writing position: writing style in the style attribute of a label

CSS syntax:

Advantages and disadvantages: poor readability, no reusability, direct writing

4. Priority of the three ways

There is no priority difference between inline and outreach, and because html is an interpreted language, what is written below overrides what is written above.

Interline precedence over everything else.

III.CSS selector

Universal Selector * {Style 1; }

Label Selector Label Name {Style 1; }

Class selector. Class Name {Style 1; }

ID Selector #ID Name {Style 1; }

Advanced selector (simple explanation)

Tag name. Class Name { Style 1; }

Keyword! important is written after the style and separated by a grid

Priority:! important > interline> id > class > label> unified

Priority based on scope: the more precise the scope, the higher the priority

Style content key If there is a choice based on priority, if there is no increase

At this point, I believe that we have a deeper understanding of "css selector and what are the three ways to introduce", may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

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