You will learn here...
stylin languge that alows you to create rules that control the way that each elment will look like in browser after rendering, It depends basicly on HTML so you cant just have CSS without HTML page first, consisting of tow parts:
-
A selector: witch mean the elment witch we should give it the ruls and must look like
p {
and there is many kinds of like: -
A declaration: witch mean the rules section witch refrence to the first part and looks like:
the rule: the property;}
so CSS declarations always sit inside curly brackets{}
so there is three esintals ways to write CSS :
when we write the whole css code in diferint file then link to it in the HTML code inside the tag <link>
when you write the CSS code inside the same HTML code Under the Tag <style>
when you write only the CSS rules in the same element line after attrbute style="the rule name='the property'"
ther is alot of selectors i will mention them in table :
Selctor | meaning of | how it looks |
---|---|---|
Universal Selector | Applies to all elements in the document | * {} |
Type Selector | Matches element names | h1, h2, h3 {} |
Cl ass Selector | Matches an element whose class attribute has a value that matches the one specified after the period (or full stop) symbol | p.note {} |
ID Selector | Matches an element whose id attribute has a value that matches the one specified after the pound or hash symbol | #introduction {} |
Child Selector | Matches an element that is a direct child of another | li>a {} |
Descendant Selector | Matches an element that is a descendent of another specified element (not just a direct child of that element) | p a {} |
Adjacent Sibling Selector | Matches an element that is the next sibling of another | h1+p {} |
General Sibling Selector | Matches an element that is a sibling of another, although it does not have to be the directly preceding element | h1~p {} |
there is many types of colors like:
and also there is three ways to specify colors to text :
witch is the simplest one and it just mention the color name after color:
witch shortcut to (RED GREEN BLUE) and the values for each color start from 0 to 255 and looks like rgb(22, 33, 44)
witch is six digits only start with #
, and evry color has one
witch css spuort for each HTML element to had one, you have to secify the color you want or it will be defultly as white color..
Hue is near to the colloquial idea of color. Technically speaking however, a color can also have saturation and brightness as well as hue
Saturation refers to the amount of gray in a color, At maximum saturation, there would be no gray in the color. At minimum saturation, the color would be mostly gray
Brightness (or "value") refers to how much black is in a color, At maximum brightness, there would be no black in the color At minimum brightness, the color would be very dark
When picking foreground and background colors, it is important to ensure that there is enough contrast for the text to be legible
When text is harder to read, low contrast between background and foreground colors in difernt worlds
For long spans of text, reducing the contrast a little bit improves readability
it is easier to read when there is higher contrast between background and foreground colors (some times you can use it If you want people to read a lot of text on your page)
witch is property lows you to specify the opacity of an element, and it should be number betwin 0.0 AND 1.0, it caled alpha value in some css attr like rgb