-
Notifications
You must be signed in to change notification settings - Fork 0
/
56 CSS 2.txt
18 lines (12 loc) · 1.55 KB
/
56 CSS 2.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
````````````````` ""_ How Does CSS Work_""`````````````````
CSS brings style to your web pages by interacting with HTML elements. Elements are the individual HTML components of a web page—for instance a paragraph—which in HTML might look like this:
<p>This is my paragraph!</p>
If you wanted to make this paragraph appear pink and bold to people viewing your web page through a web browser, you’d use CSS code that looks like this:
p { color:pink; font-weight:bold; }
In this case, “p” (the paragraph) is called the “selector”—it’s the part of CSS code specifying which HTML element the CSS styling will effect. In CSS, the selector is written to the left of the first curly bracket. The information between curly brackets is called a declaration, and it contains properties and values that are applied to the selector. Properties are things like font size, color, and margins, while values are the settings for those properties. In the example above, “color” and “font-weight” are both properties, and “pink” and “bold” are values. The full bracketed set of
{ color:pink; font-weight:bold; }
is the declaration, and again, “p” (meaning the HTML paragraph) is the selector. These same basic principles can be applied to change font sizes, background colors, margin indentations, and more. For instance. . .
body { background-color:lightblue; }
. . .would make your page’s background light blue, or. . .
p { font-size:20px; color:red; }
. . .will create a 20 point font paragraph with red letters.