An external stylesheet is a standalone . css file that is linked from a web page. The advantage of external stylesheets is that it can be created once and the rules applied to multiple web pages.
The external method in CSS refers to a way of defining the styles for an HTML document in a separate CSS file. Instead of embedding the CSS rules directly within the HTML file, you create a separate file with a .css extension that contains all the CSS code.
The external CSS file is then linked to the HTML document using the <link> tag in the <head> section of the HTML file. This allows the browser to load and apply the styles defined in the external CSS file to the HTML elements.
The advantages of using the external method include:
Here's an example of how to use the external method in CSS:
h1{ color:blue; } p{ color:red; }To download raw file Click Here
<!DOCTYPE html> <html lang="en"> <head> <title>Tutor Joes</title> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <h1>External Style</h1> <p> Lorem ipsum dolor sit, amet consectetur adipisicing elit. Qui, placeat eius! Error deserunt eaque sed non, laboriosam quaerat veritatis veniam possimus? Facilis corporis quae at alias esse optio sint dignissimos. </p> </body> </html>
In the HTML document, the <link> tag is used to link the HTML document with the external CSS file. The rel attribute is set to "stylesheet" to indicate that it's a stylesheets, and the href attribute specifies the path to the external CSS file ("style.css" in this example).
By using the external method, you can keep your HTML and CSS code separate, making it easier to manage and update styles across multiple pages. It also allows for better collaboration, as designers and developers can work independently on their respective files.
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions