External style sheet : ਇਸਦੀ ਵਰਤੋਂ ਵੱਖਰੀ ਫਾਈਲ ਬਣਾ ਕੇ ਕੀਤੀ ਜਾਂਦੀ ਹੈ। ਸਾਰੀ Coding ਇਸ ਵੱਖਰੀ ਫ਼ਾਈਲ ਵਿੱਚ ਕੀਤੀ ਜਾਂਦੀ ਹੈ ਅਤੇ ਇਸ ਫ਼ਾਈਲ ਦੀ ਐਕਸਟੈਂਸ਼ਨ .css ਹੁੰਦੀ ਹੈ। ਇਹ ਫਾਈਲ ਦੇ ਰੂਪ ਵਿੱਚ ਬਣਾਈ ਜਾਂਦੀ ਹੈ ਅਤੇ ਇਸ ਫਾਈਲ ਨੂੰ ਅਲੱਗ-ਅਲੱਗ ਦੇ ਥਪੇਜਿਜ਼ ਨਾਲ ਲਿੰਕ ਕਰਕੇ ਵਰਤਿਆ ਜਾ ਸਕਦਾ ਹੈ। ਜਦੋਂ ਇਸ ਫ਼ਾਈਲ ਵਿਚ ਤਬਦੀਲੀ ਕੀਤੀ ਜਾਂਦੀ ਹੈ ਤਾਂ ਸਾਰੇ ਲਿੰਕ ਕੀਤੇ ਵੈੱਬਪੇਜਾਂ 'ਤੇ ਇਹ ਤਬਦੀਲੀ ਦਿਖਾਈ ਦਿੰਦੀ ਹੈ। ਅਸੀਂ ਇਹ ਐਕਸਟਰਨਲ ਸਟਾਈਲ ਸੀਟ ਫਾਈਲ ਨੂੰ ਲਿੰਕ ਕਰਨ ਲਈ, ਵੈੱਬਪੇਜ ਦੇ <head> ਸੈਕਸ਼ਨ ਵਿਚ <link ਟੈਗ ਦੀ ਵਰਤੋਂ ਕਰਦੇ ਹਾਂ | ਉਦਾਹਰਣ :
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
Exteral CSS ਫਾਈਲਜ਼ ਕਿਸੇ ਵੀ ਟੈਕਸਟ ਐਡੀਟਰ ਵਿੱਚ ਬਣਾਈਆਂ ਜਾ ਸਕਦੀਆਂ ਹਨ। ਵਿੱਚ ਕੋਈ ਵੀ hian] ਟੈਗ ਨਹੀਂ ਹੋਣੇ ਚਾਹੀਦੇ। ਸਟਾਈਲ ਸੀਟ ਫਾਈਲ ਦੀ ਉਦਾਹਰਣ CSS Filename: "myStyle.css":
An external style sheet is used to define the style for many HTML pages.
To use an external style sheet, add a link to it in the <head> section of each HTML page:
Live Demo & Try it yourself!
Output
External CSS
An external style sheet is used to define the style for many HTML pages.
To use an external style sheet, add a link to it in the <head> section of each HTML page:
The external style sheet can be written in any text editor. The file must not contain any HTML code, and must be saved with a .css extension.
Here is what the "styles.css" file looks like:
"styles.css":
body {
background-color: powderblue;
}
h1 {
color: blue;
}
p {
color: red;
}