Adding CSS

Adding CSS

For website development, we need to work upon the design and layout of the website. We need to add CSS to our website. Here, we will see two ways widely followed for adding CSS to the website.

Internal Styles

Use the internal stylesheet, if you need to add a specific style to a page. Define the rules inside the <style> element and it should be placed inside the <head> section. Here’s an example,

Here’s the output,

Adding CSS Internal Stylesheet

External Styles

For adding external stylesheet, you need to create one first. Take a new text file with .css extension. Define the rules which you want and then save it. To add it to your web page, just use the <link> element.

Below you can see our external stylesheet name is style.css. You can name it whatever you like and define the styles inside it. To link it, use <link> element as shown below,

Here’s our styles defined under style.css,

CSS Selectors
CSS Units
Studyopedia Editorial Staff
Studyopedia Editorial Staff
[email protected]

We work to create free tutorials for all.

No Comments

Post A Comment