12 CSS Syntax

CSS can do a lot to a page, but we’ll focus on the basics. Advanced CSS is likely to be the realm of a web publisher or designer, not a digital writer. Knowing how to do a few things with CSS could come in handy, though.

Like HTML, CSS has syntax. Failure to code in the correct syntax will result in unexpected changes—or simply no changes—to your page. A CSS rule, as it’s called, has two main parts: a selector and a declaration. The declaration is then broken down into two more parts: a property and a value.

We’ll talk about both inline and embedded CSS in this book. Inline CSS refers to CSS coding done within your HTML code. Embedded CSS style sheets are CSS rules that are part of your HTML document. There’s a third type, called an external style sheet, that can be used to make more extensive changes. It’s unlikely that you’ll be asked to code an external style sheet as a digital writer.

Most CSS rules are going to look something like this:

 

selector {

property: value;

}

 

Like HTML code uses angle brackets, CSS uses braces to surround each rule.

This might not make much sense now, but let’s put it into practice!

License

HTML & CSS Basics for Digital Writers Copyright © by Cate Deventer. All Rights Reserved.

Share This Book