当前位置:网站首页>DW basic course (II)
DW basic course (II)
2022-04-23 21:22:00 【Programmer's simplicity】
1. In the last chapter, we learned about what is html file , So in this chapter, we will explain css The rules , So html Add style to , Every html There is a style sheet , It can be used css To set these attributes involves different aspects of element display , For example, the font of text content 、 Sub number and color , The location of element attributes, etc .CSS Is a first choice HTML Elements , Then set the selected element CSS Property mechanism .CSS The selector and the style to be applied form a line CSS The rules .
2.CSS What are the rules ?
Let's list below , Let's give a list of instructions. We set the paragraph label to blue
HTML Code
- <p> This is the paragraph tag </p>
CSS Code
- 1.p{
- 2. color: blue;
- 3.}
Browser rendering
3. Open the style sheet in the browser and press F12 You can view it in the browser HTML The structure and CSS style .
4. Complete code
- <!doctype html><!-- It is html5 Standard web statement -->
- <html><!-- Root element -->
- <head><!-- Head -->
- <meta charset="utf-8"><!-- The character set is uft-8-->
- <title> Untitled Document </title><!-- title -->
- <link rel="stylesheet" href="Untitled-3.css">
- </head>
- <body>
- <!-- This is the web content -->
- <p> This is the paragraph tag </p>
- </body>
- </html>
5.CSS Basic grammar
CSS Is a programming language , Since it is a language, there must be its grammatical rules . So next we're going to learn CSS The basic rules of grammar .
CSS The rules consist of two parts : Selector and Statement Two parts , The selector refers to the element you want to change the style , Declaration refers to the style part you need to set . The declaration consists of two parts : Properties and attribute values .
Important note :CSS and HTML The symbols in are all in English , For example, in the rule ":" Colons and ";" A semicolon .
For the basic structure above , We can make the following extensions :
6. Multiple declarations are contained in one rule
- p {
- color:blue;/* Font color style */
- font-size: 18px;/* Font size style */
}
7. Multiple selectors are combined
for example : At the same time, label the title h1 h2 h3 Set the same style properties
- <h1>hello world</h1>
- <h2>hello world</h2>
- <h3>hello world</h3>
8.CSS The rules :
- h1,h2,h3{ /* Between selectors , The English status is separated by commas */
- color: blue; /* Font color style */
- font-size: 20px;/* Font size style */
- }
9. Multiple rules apply to a selector
In a nutshell , multiple CSS A rule to change the style of an element .
- h1,h2,h3{ /* Between selectors , The English status is separated by commas */
- color: blue; /* Font color style */
- font-size: 20px;/* Font size style */
- }
- h1{
- text-align: center;/* The text content is centered */
- }
10. For the top 2 Bar rule ,H1 The final style of the label is , The font color is blue , Font size: 20 Pixels , The text content is centered .
版权声明
本文为[Programmer's simplicity]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/110/202204200620389952.html
边栏推荐
- C knowledge
- Opencv application -- jigsaw puzzle
- Introduction to tensorrt
- Pytorch selects the first k maximum (minimum) values and their indexes in the data
- unity 功能扩展
- Valueerror: invalid literal for int() with base 10 conversion error related to data type
- How to learn software testing? Self study or training? After reading this article, you will understand
- Factory mode
- [※ leetcode refers to offer 32 - II. Print binary tree II from top to bottom (simple)]
猜你喜欢
Xiaomi mobile phone has abandoned the "Mi" brand all over the world and switched to the full name brand of "Xiaomi"
airbase 初步分析
100天拿下11K,转岗测试的超全学习指南
Problem brushing plan -- dynamic programming (IV)
Minecraft 1.12.2模组开发(四十三) 自定义盾牌(Shield)
1.整理华子面经--1
thinkphp5+数据大屏展示效果
Google 尝试在 Chrome 中使用 Rust
[leetcode refers to the two numbers of offer 57. And S (simple)]
随机推荐
2. Finishing huazi Mianjing -- 2
[※ leetcode refers to offer 32 - II. Print binary tree II from top to bottom (simple)]
PHP的Laravel与Composer部署项目时常见问题
Ubuntu 20 installing centernet
Ubutnu20 installer centernet
Awk example skills
pikachuxss如何获取cookie靶场,返回首页总是失败
go reflect
DeNO 1.13.2 release
Introduce structured concurrency and release swift 5.5!
41. The first missing positive number
[SDU chart team - core] enumeration of SVG attribute class design
Reference of custom message in ROS function pack failed
Google 尝试在 Chrome 中使用 Rust
C knowledge
Singleton mode
unity 功能扩展
Pytorch selects the first k maximum (minimum) values and their indexes in the data
Unit function expansion
笔记本电脑卡顿怎么办?教你一键重装系统让电脑“复活”