CSS- What is CSS?
CSS or Cascading Style Sheets is a language that is often used to determine the appearance or style of a web page. It is usually related to an HTML document, which has all the content of a website grouped within tags, on which CSS acts, modifying the way in which they will be viewed by users.
What is CSS for?
With CSS you can change the appearance of all the elements of a web page, such as the color of the text, the size of the elements, the structuring of the content, its display and much more.
CSS is used to adapt the design of a website and make it unique and different from others, thus making it stand out from the competition. It also serves to improve the experience of users who visit the website, since the design and arrangement of its elements is one of the factors that most influence this.
CSS Types
There are three main types of CSS that we can use: inline, embedded and external.
inline css
In inline CSS, the style is written directly in the document where the content of a website is, including it directly within the tag whose style or appearance you want to modify.
Embedded CSS
Embedded CSS is located within the head tag of a website, affecting only the tags of the pages in which it is embedded.
External CSS
External CSS is that which is written in a different document than the one that contains the main structure of the web page. The styles included in the document will affect all pages to which this document is linked.
How to use CSS
To use CSS correctly, it must be written according to the structure indicated in the W3School standards. To apply a style to an element of a web page, perform the following steps:
- It is recommended that all images on the website have the ALT attribute.
- A class name or id is given to the element whose appearance we want to modify.
- We include the name of the given name of the element to our CSS code by adding “.” at the beginning of the name if it is a class, or “#” if it is an id.
- Brackets are opened and closed and the code we want is included inside.
The most used commands to change the appearance of a website using CSS are:
-
Color – This is the CSS property that changes the color of the text. You will have to indicate the color in hexadecimal code or enter the color name according to CSS standards.
-
Font-size: with this property the font size within the content of the element that we have selected is modified. You must assign a value in pixels.
-
Font-family: This property assigns a specific font to the element in which it is located.
-
Weight: The weight property assigns the width to the element.
-
Width: The width property assigns the height to the element.