Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML & CSS Quick tutorial of CSS syntax

Malcolm

Administrator
Administrator
Staff Team
Code Plus
Company Plus
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/
 
Last edited:

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom