bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/CSS

CSS

CSS Foundations

Selectors, the cascade, layout basics, spacing, typography, and the core styling model.

Lesson 1visual

CSS Tutorial

CSS Tutorial

2 min
Read lesson →
Lesson 2

CSS Introduction

CSS Introduction

2 min
Read lesson →
Lesson 3

CSS Syntax

CSS Syntax A CSS rule consists of a selector and a declaration block: The selector points to the HTML element you want to style. The declaration block contains one or more declarations separated by s…

2 min
Read lesson →
Lesson 4visual

CSS Selectors

CSS Selectors CSS selectors are used to "find" (or select) the HTML elements you want to style. We can divide CSS selectors into five categories: Simple selectors (select elements based on name, id,…

2 min
Read lesson →
Lesson 5visual

How To Add CSS

How to Add CSS When a browser reads a style sheet, it will format the HTML document according to the information in the style sheet. There are three ways of inserting a style sheet: External CSS - li…

2 min
Read lesson →
Lesson 6visual

How To Add Inline CSS

How To Add Inline CSS

2 min
Read lesson →
Lesson 7

Multiple Style Sheets & Cascading Order

Multiple Style Sheets If some properties have been defined for the same selector (element) in different style sheets, the value from the last read style sheet will be used. Assume that an external st…

2 min
Read lesson →
Lesson 8visual

CSS Comments

CSS Comments Comments are used to explain the CSS code, and may help when you edit the source code at a later date. Comments are also used to temporarily disable sections of CSS code within a stylesh…

2 min
Read lesson →
Lesson 9

CSS Errors

CSS Errors Errors in CSS can lead to unexpected behavior or styles not being applied correctly. This page shows common CSS mistakes, and how to avoid them. Missing Semicolons Forgetting a semicolon a…

2 min
Read lesson →
Lesson 10

CSS Colors

CSS Colors In CSS, colors are specified by using a predefined color name, or with a RGB, HEX, HSL, RGBA, HSLA value. CSS Color Names In CSS, a color can be specified by using a predefined color name:…

2 min
Read lesson →
Lesson 11

CSS RGB Colors

RGB Value An RGB color value represents RED, GREEN, and BLUE light sources. In CSS, a color can be specified as an RGB value, using this formula: rgb( red, green, blue ) Each parameter (red, green, a…

2 min
Read lesson →
Lesson 12

CSS HEX Colors

HEX Value A hexadecimal color is specified with: #RRGGBB. In CSS, a color can be specified using a hexadecimal value in the form: # rrggbb Where rr (red), gg (green) and bb (blue) are hexadecimal val…

2 min
Read lesson →
Lesson 13

CSS HSL Colors

HSL Value HSL stands for hue, saturation, and lightness. In CSS, a color can be specified using hue, saturation, and lightness (HSL) in the form: hsl( hue, saturation, lightness ) Hue is a degree on…

2 min
Read lesson →
Lesson 14

CSS Backgrounds

CSS Backgrounds

2 min
Read lesson →
Lesson 15

CSS Background Image Repeat

CSS Background Image Repeat

2 min
Read lesson →
Lesson 16

CSS Background Shorthand

CSS background - Shorthand property To shorten the code, it is possible to specify all the background properties in one single property. This is called a shorthand property. Instead of writing: body…

2 min
Read lesson →
Lesson 17

CSS Borders

CSS Borders The CSS border properties allow you to specify the style, width, and color of an element's border. I have borders on all sides. I have a red, bottom border. I have rounded borders. I have…

2 min
Read lesson →
Lesson 18

CSS Border Width

CSS Border Width The border-width property specifies the width of the four borders. The width can be set as a specific size (in px, pt, cm, em, etc) or by using one of the three pre-defined values: t…

2 min
Read lesson →
Lesson 19

CSS Border Color

CSS Border Color The border-color property is used to set the color of the four borders. The color can be set by: name - specify a color name, like "red" HEX - specify a HEX value, like "#ff0000" RGB…

2 min
Read lesson →
Lesson 20

CSS Shorthand Border Property

CSS Border - Shorthand Property Like you saw in the previous page, there are many properties to consider when dealing with borders. To shorten the code, it is also possible to specify all the individ…

2 min
Read lesson →
Lesson 21

CSS Margins

CSS Margins

3 min
Read lesson →
Lesson 22

CSS Margin Collapse

CSS Margin Collapse Margin collapse is when two margins collapse into a single margin. Top and bottom margins of elements are sometimes collapsed into a single margin that is equal to the largest of…

2 min
Read lesson →
Lesson 23

CSS Padding

CSS Padding The CSS padding properties are used to generate space around an element's content, inside of any defined borders. With CSS, you have full control over the padding. There are properties fo…

3 min
Read lesson →
Lesson 24

CSS Padding and box-sizing

Padding and Element Width The CSS width property specifies the width of the element's content area. The content area is the portion inside the padding, border, and margin of an element ( the box mode…

2 min
Read lesson →
Lesson 25

CSS Height and Width

CSS Height and Width The CSS height and width properties are used to set the height and width of an element. This element has a height of 70 pixels and a width of 100%. CSS Set height and width The h…

2 min
Read lesson →
Lesson 26

CSS Min/Max Height and Width

CSS Min/Max Height and Width The min-width and max-width properties are used to set the minimum and maximum width of an element. The min-height and max-height properties are used to set the minimum a…

2 min
Read lesson →
Lesson 27

CSS 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 fou…

2 min
Read lesson →
Lesson 28

CSS Outline

CSS Outline An outline is a line that is drawn around elements, OUTSIDE the borders, to make the element "stand out". This element has a black border and a green outline with a width of 5px. Note: Ou…

2 min
Read lesson →
Lesson 29

CSS Outline Width

CSS Outline Width The outline-width property specifies the width of the outline, and can have one of the following values: thin (typically 1px) medium (typically 3px) thick (typically 5px) A specific…

2 min
Read lesson →
Lesson 30

CSS Outline Color

CSS Outline Color The outline-color property is used to set the color of the outline. The color can be set by: name - specify a color name, like "red" HEX - specify a hex value, like "#ff0000" RGB -…

2 min
Read lesson →
Lesson 31

CSS Outline Shorthand

CSS Outline - Shorthand property The outline property is a shorthand property for setting the following individual outline properties: outline-width outline-style (required) outline-color You can spe…

2 min
Read lesson →
Lesson 32visual

CSS Text Color

CSS Text Formatting CSS has a lot of properties for styling and formatting text. text formatting This text is styled with some of the text formatting properties. The heading uses the text-align, text…

2 min
Read lesson →
Lesson 33

CSS Text Alignment

CSS Text Alignment

3 min
Read lesson →
Lesson 34

CSS Text Decoration

CSS Text Decoration

2 min
Read lesson →
Lesson 35

CSS Text Decoration Styles

Specify a Style for the Decoration Line The CSS text-decoration-style property sets the style of the decoration line. This property can have one of the following values: solid - Default value. Single…

2 min
Read lesson →
Lesson 36

CSS Text Transformation

CSS Text Transformation The CSS text-transform property is used to control the capitalization of text in an element. It can be used to transform a text into uppercase or lowercase letters, or capital…

2 min
Read lesson →
Lesson 37

CSS Text Spacing

CSS Text Spacing

2 min
Read lesson →
Lesson 38

CSS Text Shadow

CSS Text Shadow

2 min
Read lesson →
Lesson 39visual

CSS Fonts

CSS Fonts

2 min
Read lesson →
Lesson 40

CSS Web Safe Fonts

CSS Web Safe Fonts

4 min
Read lesson →
Lesson 41visual

CSS Font Fallbacks

CSS Font Fallbacks

2 min
Read lesson →
Lesson 42

CSS Font Style

CSS Font Style The CSS font-style property specifies the font style for a text.. This property can have one of the following values: normal - The text is shown normally italic - The text is shown in…

2 min
Read lesson →
Lesson 43visual

CSS Font Size

CSS Font Size The CSS font-size property is used to specify the size of the text/font. Being able to manage the text size is very important in web design. However, you should not use font size adjust…

4 min
Read lesson →
Lesson 44

CSS Google Fonts

Google Fonts If you do not want to use any of the standard fonts in HTML, you can use Google Fonts. Google Fonts are free to use, and have more than 1000 fonts to choose from. How To Use Google Fonts…

3 min
Read lesson →
Lesson 45

CSS Great Font Pairings

Font Pairing Rules Great font pairings are essential to great design! Here are some basic rules to create great font pairings: 1. Complement It is always safe to find font pairings that complement on…

7 min
Read lesson →
Lesson 46

CSS Font Property

The CSS Font Shorthand Property To shorten the code, it is possible to specify all the individual font properties in one declaration. The CSS font property is a shorthand property for: font-style fon…

2 min
Read lesson →
Lesson 47visual

CSS Icons - Font Awesome

CSS Icons - Font Awesome

2 min
Read lesson →
Lesson 48

CSS Icons - Bootstrap

Bootstrap Icons To use the Bootstrap glyphicons, add the following line inside the <head> section of your HTML page: <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/b…

2 min
Read lesson →
Lesson 49

CSS Icons - Google

Google Icons To use the Google icons, add the following line inside the <head> section of your HTML page: <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> Note:…

2 min
Read lesson →
Lesson 50

CSS Lists

CSS Styling Lists In HTML, there are two main types of lists: <ul> - unordered lists (list items are marked with bullets) <ol> - ordered lists (list items are marked with numbers or letters) CSS has…

3 min
Read lesson →
Lesson 51

CSS Tables

HTML tables can be greatly improved with CSS: Company Contact Country Alfreds Futterkiste Maria Anders Germany Berglunds snabbköp Christina Berglund Sweden Centro comercial Moctezuma Francisco Chang…

2 min
Read lesson →
Lesson 52

CSS Table Size (Width and Height)

CSS Table Width The CSS width property is used to set the width of a table. The width can be set: in percent (%) as a fixed length (px) by the auto keyword CSS Table Width in Percent To create a tabl…

2 min
Read lesson →
Lesson 53

CSS Table Alignment

Horizontal Alignment The CSS text-align property is used to set the horizontal alignment of the content in <th> or <td>. This property can have one of the following values: left - Aligns the text to…

2 min
Read lesson →
Lesson 54

CSS Table Styling

CSS Table Padding To add some more space between the inner borders and the content in a table, use the padding property on <td> and <th> elements: First Name Last Name Savings Peter Griffin $100 Lois…

2 min
Read lesson →
Lesson 55

CSS Responsive Tables

CSS Responsive Tables A responsive table will display a horizontal scrollbar if the screen is too small to display the full content. Resize the browser window to see the effect: First Name Last Name…

2 min
Read lesson →
Lesson 56visual

CSS The display Property

CSS The display Property

2 min
Read lesson →
Lesson 57

CSS Hide Elements

CSS display: none; When using display: none; the element is completely hidden from the document flow and does not take up any space. It is commonly used with JavaScript to hide or show elements witho…

2 min
Read lesson →
Lesson 58

CSS The max-width Property

CSS The max-width Property

2 min
Read lesson →
Lesson 59

CSS The position Property

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 positi…

2 min
Read lesson →
Lesson 60

CSS Fixed and Absolute Positioning

CSS position: fixed An element with position: fixed; is positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled. The top, right, bottom, and le…

2 min
Read lesson →
Lesson 61

CSS Sticky Positioning

CSS position: sticky An element with position: sticky; toggles between a relative and fixed position, depending on the scroll position. A sticky element is positioned relative until a certain scroll…

2 min
Read lesson →
Lesson 62

CSS Position Offsets

Positioning with top, right, bottom, and left The top, right, bottom, and left properties are used to position elements. These properties only work on positioned elements (elements with position set…

2 min
Read lesson →
Lesson 63visual

CSS The z-index Property

The CSS z-index Property The z-index property specifies the stack order of positioned elements. The stack order defines which element should be placed in front or behind other elements. When elements…

2 min
Read lesson →
Lesson 64

CSS The overflow Property

The CSS overflow Property The CSS overflow property controls what happens to content that is too big to fit into an area. It specifies whether to clip the content or to add scrollbars when the conten…

3 min
Read lesson →
Lesson 65

CSS overflow-x and overflow-y

Overflow in Specific Directions The overflow-x and overflow-y properties allow you to control overflow behavior independently for horizontal and vertical directions. CSS overflow-x and overflow-y The…

2 min
Read lesson →
Lesson 66

CSS Float

CSS Float

3 min
Read lesson →
Lesson 67

CSS clear and Clearfix Hack

The CSS clear Property The clear property specifies what should happen with the element that is NEXT to a floating element. The clear property prevents elements from wrapping around or beside the flo…

2 min
Read lesson →
Lesson 68

CSS display: inline-block

CSS display: inline-block

2 min
Read lesson →
Lesson 69

CSS Center Align

CSS Center Align

2 min
Read lesson →
Lesson 70

CSS Horizontal Align

CSS Horizontal Align

2 min
Read lesson →
Lesson 71

CSS Vertical Align

CSS Vertical Align

2 min
Read lesson →
Lesson 72visual

CSS Combinators

CSS Combinators A combinator is something that defines the relationship between two or more selectors. A CSS selector can contain more than one selector. Between the selectors, we can include a combi…

2 min
Read lesson →
Lesson 73visual

CSS Pseudo-classes

CSS Pseudo-classes A CSS pseudo-class is a keyword that can be added to a selector, to define a style for a special state of an element. Some common use for pseudo-classes: Style an element when a us…

2 min
Read lesson →
Lesson 74

CSS Interactive Pseudo-classes

Interactive Pseudo-classes Interactive pseudo-classes apply styles based on user interaction with elements. Here we use the :hover pseudo-class and the :focus pseudo-class: Mouse Over Me Pseudo-class…

2 min
Read lesson →
Lesson 75visual

CSS Structural Pseudo-classes

Structural Pseudo-classes Structural pseudo-classes select elements based on their position in the document tree. The CSS :first-child Pseudo-class The :first-child pseudo-class matches a specific el…

2 min
Read lesson →
Lesson 76visual

CSS Pseudo-elements

CSS Pseudo-Elements A CSS pseudo-element is a keyword that can be added to a selector, to style a specific part of an element. Some common use for pseudo-elements: Style the first letter or first lin…

2 min
Read lesson →
Lesson 77visual

CSS Pseudo-elements for Text

Pseudo-elements for Text Pseudo-elements for text, allow you to style specific parts of text content, such as the first line or first letter. The CSS ::first-line Pseudo-element The ::first-line pseu…

2 min
Read lesson →
Lesson 78visual

CSS Pseudo-elements for Content

Pseudo-elements for Content Pseudo-elements for content allow you to insert content before or after elements, style list markers, and more. The CSS ::before Pseudo-element The ::before pseudo-element…

2 min
Read lesson →
Lesson 79

CSS Opacity

CSS Opacity

2 min
Read lesson →
Lesson 80

CSS Navigation Bars

CSS Navigation Bars A navigation bar is an important component of web design. Navigation bars helps users to easily navigate between different sections of a website. Navigation bars are typically bui…

2 min
Read lesson →
Lesson 81visual

CSS Vertical Navigation Bar

CSS Vertical Navigation Bar In a vertical navigation bar, the navigation links are stacked vertically (on top of each other), and is typically aligned along the left or right side of a webpage. The b…

2 min
Read lesson →
Lesson 82visual

CSS Horizontal Navigation Bar

CSS Horizontal Navigation Bar

4 min
Read lesson →
Lesson 83visual

CSS Dropdowns

CSS Dropdowns

3 min
Read lesson →
Lesson 84

CSS Advanced Dropdowns

CSS Advanced Dropdowns

2 min
Read lesson →
Lesson 85visual

CSS Image Gallery

CSS Image Gallery

2 min
Read lesson →
Lesson 86visual

CSS Image Sprites

CSS Image Sprites An image sprite is a collection of various small images put into one larger image file, called a "sprite image". A sprite image is typically arranged in a grid-like way, like this:…

4 min
Read lesson →
Lesson 87

CSS Attribute Selectors

CSS Attribute Selectors

2 min
Read lesson →
Lesson 88

CSS Advanced Attribute Selectors

CSS Advanced Attribute Selectors

2 min
Read lesson →
Lesson 89

CSS Forms

CSS Styling Forms CSS is used to style HTML forms. The look of an HTML form can be greatly improved with CSS: First Name Last Name Country Australia Canada USA Styling Form Input Fields With CSS, you…

2 min
Read lesson →
Lesson 90

CSS Form Inputs

CSS Form Inputs

2 min
Read lesson →
Lesson 91

CSS Form Focus and Icons

Style Input with Focus By default, some browsers will add a blue outline around the input when it gets focus (clicked on). You can remove this behavior by adding outline: none; to the input. Use the…

2 min
Read lesson →
Lesson 92visual

CSS Form Elements

CSS Form Elements

2 min
Read lesson →
Lesson 93

CSS Counters

CSS Counters With CSS counters, you can create dynamic numbering of elements (like headings, sections, or list items) without using JavaScript. CSS counters are "variables" maintained by CSS, and the…

2 min
Read lesson →
Lesson 94

CSS Units

CSS Units

2 min
Read lesson →
Lesson 95visual

CSS Absolute Units

CSS Absolute Units

2 min
Read lesson →
Lesson 96

CSS Relative Units

CSS Relative Units

3 min
Read lesson →
Lesson 97visual

CSS Inheritance

CSS Inheritance CSS inheritance is about what happens if no value is specified for a property on an element. If no value is specified for a property, the value can either be inherited from the parent…

2 min
Read lesson →
Lesson 98

CSS Specificity

CSS Specificity CSS specificity is an algorithm that determines which style declaration is ultimately applied to an element. If two or more CSS rules point to the same element, the declaration with t…

2 min
Read lesson →
Lesson 99visual

CSS The !important Rule

CSS !important Rule The !important rule is used to give the value of a specific property the highest priority. The !important rule will override ALL previous styling rules for that specific property…

3 min
Read lesson →
Lesson 100visual

CSS Math Functions

CSS Math Functions CSS math functions allow mathematical expressions to be used as property values. In this chapter, we will explain the following math functions: calc() max() min() clamp() The CSS c…

3 min
Read lesson →
Lesson 101visual

CSS Performance Optimization

Optimizing CSS Optimizing CSS makes your website load faster and run more smoothly; which also results in a better user experience. Here are some tips for optimizing CSS: 1. Use Simple Selectors Use…

2 min
Read lesson →
Lesson 102visual

CSS Accessibility Styling

CSS Accessibility Styling A website should be designed to ensure good accessibility for all users, including those with disabilities. CSS accessibility styling is about using good styling technics to…

2 min
Read lesson →
Lesson 103

CSS Website Layout

CSS Website Layout

3 min
Read lesson →