tutorial |
---|
Another way to apply styles, is by using a <style>
tag instead of the style
property. You always have to follow these steps:
-
Read the HTML and pick what element (tag) you want to decorate or apply styles to.
-
Programmatically select the element you want to style using CSS Selectors.
-
Write the styling that you want by using CSS property rules.
But make sure your CSS code is wrapped inside a <style>
tag.
Look at this example:
<style>
a {
color: pink;
}
</style>
<a href="https://google.com" target="_blank">Click me to open google.com</a>
We have an HTML anchor <a>
that takes people to google.com when clicked.
We use CSS to select all the anchor tags and make them pink.
- Paste this code on your website to see the results.
It should look like this: