How to write CSS in html header file: 1. Introduce CSS through ""; 2. Use The "" tag introduces an external CSS file, and the syntax is "".
The operating environment of this article: Windows7 system, HTML5&&CSS3, Dell G3 computer.
Header file
element contains all head tag elements.
In the
element, you can insert scripts (scripts), style files (CSS), and various meta information; the element tags that can be added in the head area are: ,< ;style>,,,<script>,<noscript>,<base>. <p><strong>How to write css in the html header file? <p>1. Internal style sheet <p>The internal style sheet places the css style code in the <style>< in the HTML document <head> In the /style> tag, introduce css. <p>There is a type attribute type in <style>, followed by test/css, which represents CSS text. The syntax format is as follows: <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"><style type="text/css">
/*这里写CSS内容*/
</style></pre><div class="contentsignin">Copy after login</div></div><p>Features: The CSS code within a single page is unified and planning, easy to maintain, but it is easy to get confused among multiple pages</p><p>The example is as follows:</p><p><img src="https://img.php.cn/upload/image/161/115/647/1612664264676699.png" title="1612664264676699.png" alt="How to write html header file css"/></p>##The rendering is as follows:<p></p> <p><img src="https://img.php.cn/upload/image/699/321/555/1612664267905532.png" title="1612664267905532.png" alt="How to write html header file css"/></p>2. External style sheet (recommended) <p></p>The external style sheet uses the <link> tag to introduce external CSS files; usually the link tag is written in the <head> of the web page ;</head>. <p></p><link>The attributes inside include type, rel, and href. Type is fixed to text/css, rel (ie, style sheet) is fixed to stylesheet, and href naturally refers to the address of the css file. Syntax The format is: <p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"><link type="text/css" rel="stylesheet" href="css文件的存放地址"></pre><div class="contentsignin">Copy after login</div></div> The sample code is as follows: <p><p><img src="https://img.php.cn/upload/image/332/595/833/1612664272908966.png" title="1612664272908966.png" alt="How to write html header file css"/>web.css content is <p><p><img src="https://img.php.cn/upload/image/349/692/183/1612664305394839.png" title="1612664305394839.png" alt="How to write html header file css"/> effect The following <p><p><img src="https://img.php.cn/upload/image/246/168/936/1612664311440445.png" title="1612664311440445.png" alt="How to write html header file css"/> is recommended: "<p>css video tutorial<a href="https://www.php.cn/course/list/12.html" target="_blank">"<br/></script>
The above is the detailed content of How to write html header file css. For more information, please follow other related articles on the PHP Chinese website!
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn