In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to add css styles to html. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
There are three ways for html to add css styles, namely inline (using the style attribute, used within specific HTML tags), embedded (style tags put css code in the head section of a specific page), and external (using link tags to link external css files to HTML).
I. in-line formula
Use the style attribute to set the CSS style within 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.
2. Embedded type
The embedded css style is to put the css code in a section of a particular page. Embedded CSS needs to be placed between tags.
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.
An example of an internal style sheet:
P {color:white;font-size:10px;}
.center {display:block;margin:0auto;}
# button-go,#button-back {border:solid1pxblack;}
III. External connection
Externalization is the use of link tag elements to reference the external CSS file (.css file) into the HTML page, the reference needs to be placed in the part of the page.
This is the most convenient way to add CSS to a html page. In this way, any changes you make to the external CSS file will be reflected on your website.
An example of an outreach style sheet:
Style.css contains all the style rules. For example:
.xleftcol {
Float:left
Width:33%
Background:#809900
}
.xmiddlecol {
Float:left
Width:34%
Background:#eff2df
}
Most websites today use external stylesheets, which are styles written in separate documents and attached to various Web documents. External stylesheets affect any files they connect to, which means that if you have a 20-page site and each page uses the same stylesheet, you can simply edit the stylesheet when you need to change it. this makes long-term site management easier.
Thank you for reading! This is the end of this article on "how to add css style to html". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
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.