Hello Coders!
Let's say we are working on our website, and for some reason, we want all of our headings (h1) to be red and bold. Now, how do we do this?
Well, what we want to do is select a target element that we want to edit. But for us to do this we need to write proper CSS syntax. The CSS syntax contains a selector, properties and values. With this you are selecting which element you want to target, then declaring which properties you want to change by editing their values.
Here's an example:
[CODE lang="css" title="CSS Syntax"]Selector {
Property: value;
}[/CODE]
So in the case of changing the h1 element to red and bold, we'd write something like this
[CODE lang="css" title="H1 red and bold"]h1 {
color: red;
font-weight: bold;
}[/CODE]
Above I have selected h1 as my target then I’m opening it up with my curly brackets. From there I added the following properties: color and font-weight with a colon behind it followed by a value (red and bold) and semi-colon.
That’s all! This will work within your HTML document using <style> tags and in an external CSS document. If you are unsure about this, please refer to my thread: https://codeforum.org/index.php?threads/what-is-css.33/
Let's say we are working on our website, and for some reason, we want all of our headings (h1) to be red and bold. Now, how do we do this?
Well, what we want to do is select a target element that we want to edit. But for us to do this we need to write proper CSS syntax. The CSS syntax contains a selector, properties and values. With this you are selecting which element you want to target, then declaring which properties you want to change by editing their values.
Here's an example:
[CODE lang="css" title="CSS Syntax"]Selector {
Property: value;
}[/CODE]
So in the case of changing the h1 element to red and bold, we'd write something like this
[CODE lang="css" title="H1 red and bold"]h1 {
color: red;
font-weight: bold;
}[/CODE]
Above I have selected h1 as my target then I’m opening it up with my curly brackets. From there I added the following properties: color and font-weight with a colon behind it followed by a value (red and bold) and semi-colon.
That’s all! This will work within your HTML document using <style> tags and in an external CSS document. If you are unsure about this, please refer to my thread: https://codeforum.org/index.php?threads/what-is-css.33/
Last edited: