Use app×
QUIZARD
QUIZARD
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
118 views
in Information Technology by (46.8k points)
closed by

Explain External style sheet method in css. 

1 Answer

+1 vote
by (50.2k points)
selected by
 
Best answer

External Style Sheet (link to a style sheet) :

The method to link html with style sheet is called external style sheet.

An external style sheet is a text file with the extension .css. Like other files, we can place the style sheet on your web server or hard disk.

For example : save the style sheet with the name style.css and place it in a folder named style.

creating css file

To create a link from the HTML document (default.htm) to the style sheet (style.css). The following code will be inserted in the header section of the HTML code i.e. between the <head> and </head> tags. HTML file.

<link rel=”stylesheet” type=”text/css” href=”style/style.css” />

The code will be as follows :

Default.htm
<html>
<head>
 <title>My document</title>
 <link rel=”stylesheet” type=”text/css” href=”style.css” />
</head>
<body>
 <h1>My stylesheet Page</h1>
</body>
</html>

style.css
body {
 background-color: #FF0000;
}

This link will display the layout from the CSS file in the browser when displaying the HTML file.

Output of the above code will be as follows :

output of external css

One CSS file can be used to control the layout of many HTML documents. Using CSS, the change can be made in a few seconds just by changing one code in the central style sheet.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...