We can incorporate CSS into the webpage in three ways:
inline CSS styles are added to the HTML tag using the
inline CSS is not recommended because we need to add style individually for each HTML tag. It will be hard to maintain the style.
In the code above, we add the
style attribute to the
h1 tags. This applies the style to that element.
The internal CSS means inside the
head tag. We can include the
<style> tag to define the style for the webpage.
The limitation of the internal CSS is that we cannot use the defined style on another HTML page. We need to include the same
<style> section on every HTML page.
We define the styles inside the
head element in the above code.
In external CSS, we define the styles in a specific file(file extension should be
.css) and link that to our web pages using the
This is a recommended way of including styles on a webpage because we can define the common CSS styles in specific files and include that file in all web pages.
In line 3, we include an external CSS file from Github.
<link rel="stylesheet" type="text/css" href="https://darny.github.io/csstemplate/style.css" />
We link the
style.css file using the
link tag in the above HTML file.
This loads the styles from the
View all Courses