Default Display Property Block
/* Default Display Property
Block : Always starts a new line and takes full width
Inline : Does not start and only take up as much as content space
*/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Tutorial</title>
<!-- google fonts -->
<!-- <link href="https://fonts.googleapis.com/css2?family=Open+Sans&family=Yesteryear&display=swap" rel="stylesheet"> -->
<link rel="stylesheet" href="styles.css">
</head>
<body >
<div class="block">i'm block element</div>
<h1 class="block">i'm block element</h1>
<p class="block">i'm block element</p>
<span class="inline">i'm inline element</span>
<a href="#" class="inline">i'm inline elemnet</a>
<img src="/detox.jpg" width="50" alt="">
</body>
</html>
css:
/* Default Display Property
Block : Always starts a new line and takes full width
Inline : Does not start and only take up as much as content space
*/
body{
text-align: center;
}
.block{
background: blue;
color: white;
width: 150px;
margin: 20px auto;
/* margin-left: auto;
margin-right: auto; */
}
.inline {
background: red;
color: white;
}
评论
发表评论