CSS code can be stored in the following three places: Inline CSS: Written in the style attribute of an HTML element, it only affects specific elements. Inline CSS: Written within the element of the HTML document, affecting all page elements. External CSS: Stored in a separate .css file, linked to the HTML document through the <link> element for easy maintenance and management. </p></blockquote> <p><img src="https://img.php.cn/upload/article/202404/06/2024040603151943707.jpg" alt="Where is the css code written?" ></p> <p><strong>#Where is the CSS code stored? </strong></p> <p>CSS code is usually stored in the following way: </p> <p><strong>1. Inline CSS: </strong></p> <ul> <li>Written in the style of the HTML element in properties. </li> <li>Applies only to specific elements and does not affect other elements. </li> <li>For example:<code><p style="color: red;">text</p></code> </li> </ul> <p>##2. Embed CSS : <strong></strong></p> <ul>Written within the <style> element in the HTML document. <li>Affects all page elements. <li>For example: <li> </ul> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre><code class="html"><head> <style> body { background-color: blue; } Copy after login 3. External CSS: Store in a separate .css file. Link to an HTML document via the element. The advantages are: easy maintenance, changing one file can affect multiple pages. For example: Copy after login Best Practice: It is generally recommended to use external CSS as it is easier to maintain and manage. Inline CSS should only be used for minor styling tweaks, while inline CSS is best used for general styling that affects the entire page.