Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the differences between CSS and HTLM

Shulou Source: shulou.com Published: 2022-06-01 06:35:02 10月04日 Update

This article will explain in detail what are the differences between CSS and HTLM. Xiaobian thinks it is quite practical, so share it with you as a reference. I hope you can gain something after reading this article.

CSS: Cascading Style Sheet

CSS is all about adding style to HTML page tags.

Why CSS?

Deficiencies of HTML:

1. Inability to accommodate multiple devices

2. Requires browsers to be intelligent and large enough

3. Data and display are not separated

4. Not powerful enough.

CSS Benefits:

1. Separate data from display

2. reduce network traffic

3. Make the entire site visually consistent

4. Increased development efficiency

CSS syntax

p{color:red;}

selector {property name: property value;}

The selector must be followed by braces. Attribute names must be separated by colons. Attribute values followed by semicolons

It's best not to have spaces between attribute names and colons.

How CSS and HTML are combined

CSS code is theoretically arbitrary, but usually written in style tags

CSS and HTML can be combined in three ways:

a. Row-level stylesheets: style attributes, ranges apply only to this label

Hello everyone

b. inline style sheets: done with labels. Scope for this page

c. External style sheets: Build style sheet files using. For multiple pages.

Ways to introduce style sheet files:

1): Use labels

eg:

2): Use import, must be written in the label, and must be the first sentence

eg: @import url(a.css) ;

The difference between the two ways of introduction:

Labels cannot be written in external stylesheets, but import statements can be written

About "CSS and HTLM comparison and difference what" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.

Tags: Styles tags attributes methods articles pages colons data files more scope selection good practical powerful consistent not enough between code advantages Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Information NVidia Apple Shulou Tech Info