Professional Documents
Culture Documents
My Learning Udemy
My Learning Udemy
My Learning Udemy
em tag insted of i
Internal CSS:
Style tag in head
<style>
body
background-color: #D8FFF1;
</style>
The border-style property may be specified using one, two, three, or four values.
When one value is specified, it applies the same style to all four sides.
When two values are specified, the first style applies to the top and bottom, the second to the left
and right.
When three values are specified, the first style applies to the top, the second to the left and right,
the third to the bottom.
When four values are specified, the styles apply to the top, right, bottom, and left in that order
(clockwise).
External CSS:
Create a separate CSS page and link it to the HTML File.
CSS Syntax
Selector{property: value;}
#id_name{}
Class: any class can have same name (for groups all going to behave same)
.Class_name{}
Pseudo class:
Padding:
Margin:
CSS Display Property
Block
: Take whole width of the screen and that’s why they lock out other elements.
Hello
It doesn’t take the whole width of screen. Just the space which is required.
Hello World
Inline Block:
Elements
{Display: inline-block;}
None
Element
Display: None;
Default Rules for How thing get rendered on the screen based on HTML Code.
1. Content is everything.
2. Order comes from HTML Code.
3. Children Sits on Parents. <div><h1>A <span>Prog</span>ramer</h1></div>
Position elements on Screen
1. Static All HTML elements are static in position by default. HTML without CSS and changing
any Position
2. Relativeallows us to position the element we select relevant to position when it is static.
Img
{
Position: relative;
Left:30px; // Coordinates (Top,Botton,Left,Right)
}
i. When you move an element that has a relevant position, it doesn’t affect
the position of anything on the screen.
ii. When we change the coordinates property, we are taking the left where the
image used to be and we are giving it 30px margin from the left of our
current img.
3. Absoluteit changes according to the instructions irrevelant to static default.
.Red
{
background-color:Red;
width:20px;
Height:20px;
position:absolute;
top:40px;
left:40px;
}
4. Fixed
Top:0;
So when we scroll the page the fixed position will be fixed on the page.
Em in CSS
That is the M is the width of capital letter M.
2em == MM size.
16px=100%=1em=1rem.
Rem
Ignore all the parent size, it will be the same we set.
Always try to use rem when sizing in CSS.
Float
.css
width: 25%;
float: left;
We also can use clear:left property to set the <p>text infront of image to be at the bottom.
Only use float when it is really really necessary. Only use for wrapping text around an element.
Don’t use it for positioning only use relative, margin and padding for positioning.