Lecture
Any HTML tag can be used as a selector for which formatting rules are defined, such as: color, background, size, etc. The rules are defined as follows.
Tag {property1: value; property 2: value; ...}
First, the name of the tag is indicated, the design of which will be redefined, it does not matter in upper or lower case characters. Inside the curly braces is written style property, and after the colon - its value. The set of properties is separated by a semicolon and can be located in one line or in several (Example 7.1).
Example 7.1. Change paragraph tag style
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>Селекторы тегов</title> <style> P { text-align: justify; /* Выравнивание по ширине */ color: green; /* Зеленый цвет текста */ } </style> </head> <body> <p>Более эффективным способом ловли льва в пустыне является метод золотого сечения. При его использовании пустыня делится на две неравные части, размер которых подчиняется правилу золотого сечения.</p> </body> </html>
In this example, the color and alignment of the paragraph text changes. The style will be applied only to text that is inside the <p> container.
It should be understood that although the style can be applied to any tag, the result will be noticeable only for tags that are directly displayed in the <body> container.
1. Which line contains an error?
2. Tanya chose the colors # ffe9f2 and # 6e143b for the background of the web page and the text color and used the following code in the styles, however the colors did not appear. What is the reason?
body {
background-color: # ffe9f2
color: # 6e143b
}
3. Which line is spelled correctly?
4. To which selector should the margin property be applied to change the indents on the web page?
5. How to add a background color to all <H1> elements?
1. head {color: #rob; }
2. Not enough semicolon.
3. P {color: # 333; }
4. BODY
5. h1 {background-color: white}
Comments
To leave a comment
Cascading CSS / CSS3 Style Sheets
Terms: Cascading CSS / CSS3 Style Sheets