Introduction to CSS
CSS (Cascading Style Sheets) is a cascading style sheet used to define the display effect of web pages. It can solve the duplication of style definitions in HTML code, improve the maintainability of later style code, and enhance the display effect of web pages.
Function: CSS separates web page content and display style, improving the display function.
Combination of CSS and HTML
Use the style attribute in the tag to change the display style of each tag.
Example:
<p style="background-color:#FF0000; color:#FFFFFF"> p标签段落内容。</p>
This method is more flexible, but it is more troublesome to define the same style for multiple identical tags and is suitable for local modification.
Add the style tag to the head tag to modify multiple tags uniformly.
<head> <style type=”text/css”> p { color:#FF0000;} </style></head>
This method can uniformly set the style of a single page, but it is not flexible enough for local areas.
The premise is that there is already a defined CSS file. If part of the style of the web page needs to be used, then use this method.
Example:
<style type="text/css"> @import url(css_3.css); p { color:#FF0000;}</style>
Define the end of an external CSS file (.css).
@import url("the address of the css file"); needs to be written inside the