thumbnail

Contact

Author

Med Amine TERBAH

Med Amine TERBAH

Chapter 4 : Cascading Style Sheets CSS

Before you go into the CSS course i suggest that you take a look at this HTML tuto : HTML Tuto

What is CSS?

CSS stands for Cascading Style Sheets. It is a style sheet language used for describing the presentation of a document written in a markup language such as HTML or XML. CSS is a cornerstone technology of the World Wide Web, alongside HTML and JavaScript.

How is CSS used?

CSS is used to control the appearance of web pages. It can be used to change the font, color, size, and layout of text, as well as the appearance of images, tables, and other elements on a web page. CSS can also be used to create complex layouts and animations.

Types of CSS :

There are two main types of CSS: internal and external.

Internal : CSS is embedded within the HTML document, while external CSS is stored in a separate file.

External : CSS is generally preferred, as it makes it easier to maintain and update the styles for a web page.

Here are some of the benefits of using CSS:

  • CSS makes it easy to change the appearance of a web page without having to modify the HTML code.
  • CSS can be used to create complex layouts and animations.
  • CSS can be used to create different styles for different devices, such as desktop computers, laptops, tablets, and smartphones.

How to learn CSS ?

There are many ways to learn CSS. You can take a class, read a book, or watch online tutorials. There are also many websites that offer free CSS tutorials.

Here are some basic CSS properties:

  • Font: The font property specifies the font family, size, and weight of text.
  • Color: The color property specifies the color of text.
  • Background: The background property specifies the background color or image of an element.
  • Border: The border property specifies the border style, width, and color of an element.
  • Margin: The margin property specifies the space around an element.
  • Padding: The padding property specifies the space inside an element.

Here are some basic CSS selectors:

  • ID selector: The ID selector is used to select an element with a specific ID.
  • Class selector: The class selector is used to select elements with a specific class.
  • Descendant selector: The descendant selector is used to select elements that are descendants of another element.
  • Adjacent sibling selector: The adjacent sibling selector is used to select elements that are siblings of another element and immediately follow it.
  • General sibling selector: The general sibling selector is used to select elements that are siblings of another element.

Here are some basic CSS rules:

  • Declaration: A declaration specifies a property and its value.
  • Rule: A rule consists of a selector and a declaration block.
  • Declaration block: A declaration block is a set of declarations enclosed in curly braces.

Here are some basic CSS syntax:

  • Property name: The property name is the name of the CSS property.
  • Property value: The property value is the value of the CSS property.
  • Semicolon: A semicolon is used to separate property values.
  • New line: A new line is used to separate rules.

Here are some basic CSS examples:

  • To change the font of all paragraphs to Arial, you would use the following code:
p {
    font-family: Arial;
}
a {
    color: blue;
}
img {
    border: 1px solid black;
}
Otherwise here is an html css poor design made by me in my earliest days of web development:Source code

See you soon!