In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article Xiaobian for you to introduce in detail "html how to add css style", the content is detailed, the steps are clear, the details are handled properly, I hope this "html how to add css style" article can help you solve your doubts, following the editor's ideas slowly in-depth, let's learn new knowledge together.
First of all, what are the three ways to add css styles to html? They are:
1. Use inline CSS to apply the rules of a specific element, that is, inline
2. Use internal CSS and include CSS rules in the HTML document section, that is, embedded
3. Link to an external file (.css file) that contains all CSS rules, that is, externally
Next, we will specifically introduce the implementation, advantages and disadvantages of in-line type, embedded type and external type.
I. in-line formula
Inline CSS is used within specific HTML tags. Property is used to style a specific HTML tag. Inline CSS is not recommended because each HTML tag needs to be styled separately, and if you only use inline CSS, it can be very difficult to manage a Web site. However, it is useful in some cases. For example, if you do not have access to the CSS file or only need to apply styles to a single element. An example of a HTML page with inline CSS is as follows:
HostingerTutorials
Somethingusefullhere.
Advantages of inline CSS:
1. This is useful if you want to test and preview changes.
2. It is very useful for quick repair.
3. Reduce the HTTP request.
Disadvantages of inline CSS:
Inline CSS must be applied to each element.
2. Embedded type
The embedded css style is to put the css code in a section of a particular page. Classes and ID can be used to reference CSS code, but they are active only on that particular page. The CSS style embedded in this way is downloaded each time the page is loaded, which increases the loading speed. It is useful to use embedded stylesheets in some cases, such as sending someone a page template because everything is on the same page, so it is much easier to see the preview. The embedded CSS should be placed between the tags. An example of an internal style sheet:
P {color:white;font-size:10px;}
.center {display:block;margin:0auto;}
# button-go,#button-back {border:solid1pxblack;}
Advantages of embedded CSS:
1. The stylesheet affects only one page.
2. Internal stylesheets can use classes and ID.
There is no need to upload multiple files. HTML and CSS can be in the same file.
Disadvantages of embedded CSS:
1. Increase the page loading time.
2. It affects only one page-it's useless if you want to use the same CSS on multiple documents.
III. External connection
Perhaps the most convenient way to add CSS to a html page is to link it to an external file (.css file). In this way, any changes you make to the external CSS file will be reflected on your website. References to external CSS files should be placed in the section of the page, for example:
Style.css contains all the style rules. For example:
.xleftcol {
Float:left
Width:33%
Background:#809900
}
.xmiddlecol {
Float:left
Width:34%
Background:#eff2df
}
Advantages of Outreach CSS:
1. HTML pages are smaller in size and clearer in structure.
2. The loading speed is faster.
3. The same .css file can be used on multiple pages.
Shortcomings of Outreach CSS:
The page may not render correctly until the external CSS is loaded.
Read here, this "html how to add css style" article has been introduced, want to master the knowledge of this article also need to practice and use in order to understand, if you want to know more related articles, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.