You are on page 1of 3

Department of Electronics and Communications

Engineering Institute of Technology, Nirma University


2CSOE77 Web technologies
20BEC111 - Harshesh Shah

Practical 7

Demonstrate Margin, Padding and Outline properties in CSS.


html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<div class="box margin-box">
<p>20px margin</p>
</div>

<div class="box padding-box">


<p>15px padding inside</p>
</div>

<div class="box outline-box">


<p>2px red outline</p>
</div>
</body>
</html>

css
body{

background-color: black;
}

.box {

width: 200px;

height: 100px;

text-align: center;

font-size: 16px;

line-height: 100px;

.margin-box {

background-color: #3498db;

margin: 20px;

.padding-box {

background-color: #e67e22;

padding: 15px;

.outline-box {

background-color: #2ecc71;

outline: 2px solid #e74c3c;

}
output

Conclusion:

In this experiment, I learned about Margin, Padding and Outline properties in CSS and
demonstrated its working on basic HTML.

You might also like