What is CSS?

CSS are the acronym in English for Cascading Style Sheets, which means “cascading style sheets”. It is a language used to style elements written in a markup language such as .

CSS was developed by W3C () in 1996 for a very simple reason. HTML was not designed to have tags to help format the page. It is made just to write the markup for the site.

Labels such as in HTML version 3.2, and this caused the developers a lot of trouble. Since the websites had different fonts, background colors, and styles, the process of rewriting the code was long, painful, and expensive. Therefore, CSS was created by the W3C to solve this problem.

The relationship between HTML and CSS is very strong. Since HTML is a markup language (that is, it forms the basis of a site) and CSS emphasizes styling (the entire aesthetic part of a website), they go hand in hand.

CSS isn’t technically a necessity, but you don’t want to have a site that only has HTML, as it would look completely bare.

CSS is what is called a cascading style sheet language and is used to style elements written in a markup language such as HTML. Separate the content from the visual representation of the site.

Advantages of CSS

The difference between a website that implements CSS and one that doesn’t is huge and definitely noticeable.

Perhaps you have seen some website that cannot be loaded completely and has a white background with most of the text in blue and black. That means the CSS part of the site did not load correctly or does not exist.

See also  Security in web applications: What is it, how does it work and the best services

This is what an HTML-only site looks like, and I think you’ll agree that it doesn’t look very good.

Before CSS, all styling had to be included in the HTML markup. This means that all backgrounds, font colors, alignments, etc. had to be described separately.

CSS allows you to style everything in a separate file, creating the style there and then embedding the CSS file on top of the HTML markup. This makes the HTML markup much cleaner and easier to maintain.

In short, with CSS you don’t have to repeatedly describe what individual elements look like. This saves time, makes the code shorter and less error prone.

CSS allows you to have multiple styles on an HTML page, and this makes the customization possibilities almost endless. Today, this is becoming more of a necessity than a staple.

How CSS works

CSS uses a simple English-based syntax with a set of rules that govern it. As we mentioned earlier, HTML was not intended to be used for styling elements, but only for page markup. It was created simply to describe the content. For example:

This is a paragraph.

.

But how do you apply a style to the paragraph? The CSS syntax structure is quite simple. It has a selector and a declaration block. You first select an element and then declare what you want to do with it. Pretty simple, right?

However, there are rules that you must remember. The rules of the structure are quite simple, so don’t worry.

The selector points to the HTML element you want to style. The declaration block contains one or more declarations separated by semicolons.

See also  cPanel Hosting | Hosting with cPanel and Total Control

Each declaration includes a CSS property name and value, separated by a colon. A CSS declaration always ends with a semicolon, and declaration blocks are surrounded by braces.

Let’s look at an example:

All the elements

They will appear blue and bold.

Now let's talk about the different , which are Inline, External and Internal.

Internal, external and inline CSS styles

We will do a short review of each style, and for a detailed explanation of each method, there will be a link below the description.

Let's start talking about the style Internal. CSS styles made this way are loaded every time a website is updated, which can increase load time. Also, you will not be able to use the same CSS style on multiple pages, since it is contained in a single page. However, this also has its benefits. Having everything on one page makes it easy to share the template for a preview.

The method External could be the most convenient. Everything is done externally in a file .css. This means that you can do all the styling in a separate file and apply the CSS to any page you want. The style External it can also improve loading times.

Finally, let's talk about the style line of css. Inline works with specific elements that have the