Adding CSS

For website development, we need to work on 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,

Output

Adding CSS Internal Stylesheet

External Styles

For adding an external stylesheet, you need to create one first. Take a new text file with a .css extension. Define the rules that you want and then save them. 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 are our styles defined under,

style.css

CSS Selectors
CSS Units
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading