Web Programming Lab 3

Index

Main note

CSS

CSS is Cascading Selection Sheet

Padding

Padding is the space between the content of an element and its border. It is used to create space inside the element, pushing the content away from the edges. Padding can be set for each side of an element (top, right, bottom, left) individually, or all sides at once.

Syntax:

padding: 10px; /* all sides */
padding-top: 10px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;

Margin

Margin is the space outside the border of an element. It is used to create space between the element and its surrounding elements. Like padding, margin can be set for each side individually or all sides at once.

Syntax:

margin: 10px; /* all sides */
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
margin-left: 10px;

Border

Border is a line that surrounds the padding and content of an element. It is used to visually separate an element from others. The border can have different styles, widths, and colors.

Syntax:

border: 1px solid black; /* shorthand for width, style, color */
border-width: 1px;
border-style: solid;
border-color: black;

References

Information
  • date: 2024.07.31
  • time: 10:46