Basic CSS Properties
Commonly used CSS properties
Basic CSS introduction
Anatomy of a CSS rule
Rules - an individual block of CSS that instructs the browser on how to style the page
- Selector - indicates which HTML element will be styled
- Declaration - a statement that tells the browser what to do with the elements
- Property - the characteristic of the element that will be changed
- Value - the new value of the property
Styling by HTML tag
The following CSS rule will make the text of all paragraphs in the page red.
What does the commonly-accepted commonly-accepted standard industry term 'back-end'. Clicking on this link which refers to B2B Marketing awards shortlist will take you to the awards page of the customer journey.
It may seem terrific, but it's 100% realistic! What does the term 'structuring'. If all of this comes off as mixed-up to you, that's because it is! If you productize globally, you may also mesh iteravely.
p {
color: red;
}
Styling by attribute
In the following CSS rule, if an image has an alt
text, it will have a red border.
img[alt] {
border: 3px solid red;
}
We can reverse this by adding the :not()
pseudo-class. In this next example, the image with no alt
text will have a red border.
img:not([alt]) {
border: 3px solid red;
}
Styling by class
We can add the class
attribute to any HTML tag and add any word we like. We can then use that class to style the element.
We will grow our capability to upgrade. Is it more important for something to be dynamic or to be customer-directed? What does the term 'short-term' really mean?
Have you ever needed to maximize your feature set? In one step? What do we incubate? Anything and everything, regardless of obscureness! Our feature set is unparalleled, but our raw bandwidth and easy operation is invariably considered a remarkable achievement.
<p class="red-text">
We will grow our capability to upgrade. Is it more important for something to
be dynamic or to be customer-directed? What does the term 'short-term' really
mean?
</p>
<p>
Have you ever needed to maximize your feature set? In one step? What do we
incubate? Anything and everything, regardless of obscureness! Our feature set
is unparalleled, but our raw bandwidth and easy operation is invariably
considered a remarkable achievement.
</p>
.red-text {
color: red;
}
We can use multiple different classes in a single HTML tag, like in the next example
White text on purple background
<h3 class="fg-white bg-purple">White text on purple background</h3>
.fg-white {
color: white;
}
.bg-purple {
background-color: purple;
}
Text properties
Property | Description | Values | Examples |
---|---|---|---|
color |
sets the color of the text | Any color, hexadecimal colors (there's a color picker you can use for this) |
|
line-height |
sets the distance between lines of text | "normal ", any number, any length (with unit like px or rem and em , and numerical percentage. |
|
text-align |
sets the alignment of text | "left ", "center ", "right ", "justify " |
|
letter-spacing |
sets the amount of space between characters | "normal ", or any number with unit (px , rem , em ) |
|
text-transform |
sets the casing of letters | "none ", "capitalize ", "uppercase ", "lowercase " |
|
Border
Fonts
Property | Description | Values | Examples |
---|---|---|---|
font-family |
the font to use for this element | Any font in your system |
|
font-size |
the size of the font | any length with unit (the best unit for this is rem ) |
|
font-weight |
the thickness of the font | normal , bold , bolder ,lighter |
|
font-style |
the style of the font | normal , italic , oblique (some of these values might not work if the font you are using doesn't support it |
|