Spacing & Sizing

CSS Margins The CSS margin properties are used to create space around elements, outside of any defined borders. Margins define the distance between an element’s border and the surrounding elements. With CSS, you have full control over the margins. CSS has properties for setting the margin for each individual side of an element (top, right, […]

CSS Grid

CSS Grid Components A grid always consists of: A Grid Container – The parent (container) element, where the display property is set to grid or inline-grid One or more Grid Items – The direct children of the grid container automatically becomes grid items Example

Result CSS Grid Container A grid container contains one or more grid items arranged in columns and […]

Flexbox

CSS Flexbox (Flexible Box Layout) CSS Flexbox is short for the CSS Flexible Box Layout module. Flexbox is a layout model for arranging items (horizontally or vertically) within a container, in a flexible and responsive way. Flexbox makes it easy to design a flexible and responsive layout, without using float or positioning.

CSS Flex Container Properties […]

Float & Clear

The CSS float Property The float property specifies how an element should float within its container. It places an element on the left or right side of its container, allowing text and inline elements to wrap around it. The float property can have one of the following values: left – The element floats to the left of its container right – […]

Positioning

CSS Positioning CSS positioning is about controlling the placement of elements within a web page. With CSS positioning, you can override the normal document flow. The CSS position Property The position property specifies the positioning type for an element. This property can have one of the following values: static – This is default. Element is positioned according to […]

Display & Visibility

The CSS display Property The display property is an important CSS property for controlling layout. It specifies whether an HTML element is treated as a block or an inline element. Every HTML element has a default display value, depending on what type of element it is. The default display value for most elements is block or inline. The display property is used […]

Borders & Shadows

CSS Border Style The border-style property specifies what kind of border to display. The following values are allowed: dotted – Defines a dotted border dashed – Defines a dashed border solid – Defines a solid border double – Defines a double border groove – Defines a 3D grooved border. The effect depends on the border-color value ridge – Defines a 3D ridged border. […]

Backgrounds

CSS Backgrounds The CSS background properties are used to add background effects for elements. In these chapters, you will learn about the following CSS background properties: background-color background-image background-repeat background-attachment background-position background (shorthand property) CSS background-color The background-color property specifies the background color of an element. Example The background color of a page is set like this:

[…]

Box Model

The CSS Box Model In CSS, the term “box model” is used when talking about web design and layout. The CSS box model is essentially a box that wraps around every HTML element. Every box consists of four parts: content, padding, borders and margins. The image below illustrates the CSS box model: Explanation of the […]

Text & Typography

CSS Text Formatting CSS has a lot of properties for styling and formatting text.

CSS Text Color The color property is used to set the color of the text. The color is specified by: a color name – like “red” a HEX value – like “#ff0000” an RGB value – like “rgb(255,0,0)” Look at CSS Color Values for […]