Main menu

Pages

CSS basics - cs academy

 Concept - CSS CSS is an acronym for Cascading Style Sheets, which stands for Cascading Style Sheets. It is a formatting language for web pages concerned with the appearance and design of websites, and was specifically designed to isolate formatting from document content written in html.


CSS basics

CSS is not a programming language, and it is concerned with the general appearance of the site's pages such as colors, images, etc., and CSS can be added to the page in several ways, the best of which is external embedding by writing CSS code in a separate file.


Just as HTML defines the structure of a page and tells browsers the function of each element on the page (such as a link to another page or a header), CSS gives instructions to the browser on how to display the elements on the page in terms of design, distance, and location.



Assuming that HTML is based on building the structure of the house, then CSS will draw the house and design its decoration.


This is done through a set of instructions that we will learn how to include later. These instructions (or rules) define what should be formatted and styled on HTML elements.


CSS is not a programming language, not like JavaScript, not a structured language like HTML, and in fact this language cannot be compared to any other technology.


Also read:


HTML basics

Advantages, disadvantages and salaries of the most popular programming languages

Before web development processes, some of the techniques used were to define the interface of the site and combine the structure and presentation, and this is not a smart thing to do in the ever-changing environment, especially web pages, which is why the CSS language was invented.


Where do you write the CSS

The first way: it is called inline style, which is to write the properties and values inside the html tag as the value of the style property.



The second method: it is called the inner style, which is to write a separate css code in the same html file inside the style tag in the head of the page.


The last and third method: it is called external style, which is to write the css code in a separate external file and point to its path in the page header using a single tag link, and we write the css code normally in a separate file that we call style. css and put it in the same path as the html file.


The 5 most popular CSS codes

1-width                                                                                                                                                       


It is a tag to display the element

It is written in width: 100px;

The number 100 changes to any number greater or less


2-height


It's the height

And write as follows

height: 100px;

The same with regard to changing the number


3- The padded space


It is the area of the internal space of the element or annotation.

The padding writes: 10px 15px 6px 8px;

10 void from above

15 right

6 down

8 left

You can write it as padding: 10px;

This means that the area will be 10 pixels wide on all sides


4-margin


Like padding, but this outer padding goes around the element and distances it from the elements next to it.

And write the same way:

margin: 10px 15px 6px 8px;


Also read:


Tips to become a professional web designer

Programming steps

Learn to code through academic study or self-teaching

5 colors


It is the color of the texts in the elements.

And write as follows

color: #000000;

Just change #000000 to another color code

And you can add a background

Its grain becomes the background color of the element, not the text, as follows:

background-color: #000000;

Comments

table of contents title