Web Development Question:
Download Questions PDF

How you can store CSS definitions in external files?

Web Development Interview Question
Web Development Interview Question


If you want to share a set of CSS definitions with multiple HTML documents, you should those CSS definitions in an external file, and link it to those HTML documents using the LINK tag in the HEAD tag as:

<LINK REL=stylesheet TYPE="text/css" HREF="css_file_url"/>

Below is a CSS file called, GlobalGuideLine.css, that stores the same CSS definitions used in the previous exercise:

BODY {background-color: black}
P {color: yellow}

If you modify the HTML document with the LINK tag instead of the STYLE tag, you can get the same result:

<title>CSS Linked</title>
<link rel=stylesheet type="text/css" href="GlobalGuideLine.css"/>
<p>Welcome to GlobalGuideLine.com.
You should see this text in yellow on black background.</p>

Download Web Development Interview Questions And Answers PDF

Previous QuestionNext Question
How I can include CSS inside the HEAD tag?Can you please explain the difference between CSS and CSS3?