forked from Daniyal-Murtaza/html-css
-
Notifications
You must be signed in to change notification settings - Fork 0
/
css-block,inline,inlineblock.html
51 lines (35 loc) · 2.02 KB
/
css-block,inline,inlineblock.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./CSS/css-block,inline,inlineblock.css">
<title>Block level/ Inline/ Inline Block</title>
</head>
<body>
<!-- visualizing an element of block level element -->
<!-- starts with new line and only takes the necessary amount of width (can change width or height)-->
<h1>Block level element</h1>
<h1>examples: div p headings ul ol li form aside main nav</h1>
<p>Takes full width and starts with new line untill or unless manually changed</p>
<nav>Nav bar</a></nav><br>
<!-- visualizing an element of inline element -->
<!-- does not starts with new line and only takes the necessary amount of width (cannot change width or height)-->
<h1>inline elements (anchor,span etc)</h1>
<p>in inline elements the margin adds at right or left only////top or bottom will remain default given below is inline</p>
<p>Padding in inline elements will make the things awkward for top and bottom but left and right is good</p>
<a href="">link1</a>
<a href="">link2</a><br>
<!-- to change from block level to inline element (display: inline;) -->
<!-- to change from inline element to block level (display: block;) -->
<!-- image tag is an important exception of inline element/ we can change it's width and height -->
<img src="https://miro.medium.com/max/1838/1*AFeOAqXNJJdfYAjfXiJ9AQ.jpeg" alt="">
<img src="https://i.ytimg.com/vi/fUwDHLYvOig/maxresdefault.jpg" alt="">
<!-- also includes padding and margin in all sides appropriately -->
<!-- if we changes it's width then we donot have to specify it's height and vice versa because by default chooses the appropriate size -->
<!-- INLINE BLOCK element (inline block is their display) -->
<!-- we can now change their width height padding margin -->
<a href="" class="a1">my website 1</a>
<a href="" class="a2">my website 2</a>
</body>
</html>