Course
Margins
CSS Tutorial
This CSS tutorial is designed for beginners to navigate through the essentials and intricate aspects of CSS styling. Upon finishing this tutorial, participants will possess a comprehensive understanding of CSS, setting a solid foundation for further exploration and mastery. This guide aims to equip you with the skills necessary to transform your visions into visually appealing web designs, laying the groundwork for your journey towards becoming an accomplished web designer.
Margins
This chapter discusses about the margins in CSS. Margins are used to create space around an element.
They define the amount of space between an element's border and adjacent elements.
Possible Values
Following values can be passed to each side:
Note: Negative values are allowed to be passed as margin.
Syntax
selector { margin: top right bottom left; }
You can specify margins for all sides at once (top, right, bottom, left) or set specific values for individual sides.
CSS Margins - Related Properties
You can set the margin for each side individually, which is as follows: