DEV Community

Cover image for [VISUAL] CSS Intro, Syntax & the CSS Cascade
Mohamed Yahia
Mohamed Yahia

Posted on

2

[VISUAL] CSS Intro, Syntax & the CSS Cascade

Image description

CSS Syntax

Image description

Image description

Image description

Image description

CSS Specificity

Image description

Image description

Image description

Link CSS to HTML

To write the css in a seperate file, you have to link that file to the html.
In the head element, make a new element called link and write this:

<head>
    <link href="styles.css" rel="stylesheet"/>
</head>
Enter fullscreen mode Exit fullscreen mode

href attribute specifies the path of the file, if the file is in the same directory as the html, then you just write the file name.

href stands for hypertext reference and yes the value of that attribute (the path) is a reference to the file.

rel stands for relation and here we are specifying the relation of that file we referenced. Is it a stylesheet file, a favicon, it is an alternative page in a different language?

Tiugo image

Modular, Fast, and Built for Developers

CKEditor 5 gives you full control over your editing experience. A modular architecture means you get high performance, fewer re-renders and a setup that scales with your needs.

Start now

Top comments (0)

Image of Stellar post

Check out Episode 1: How a Hackathon Project Became a Web3 Startup 🚀

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay