HOME | PHP Tutorial | CSS
facebook icon
AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP
HTML Tutorial

CSS Tutorial

Basic Syntax of CSS - How to Code CSS

A CSS comprises of style rules that are interpreted by the browser and then applied to the corresponding elements in your document. A style rule is made of three parts: a selector, a property, and a value. CSS selectors are used to find HTML elements based on their element name as: id, class, attribute, and more.

autocar

The element Selector

The element selector selects elements based on the element name.
You can select all <h1> elements on a page like this (all elements will be left-aligned, with a green text color).

Example:
h1 {
text-align: left;
color: green;
}

The id Selector

The id selector is used to select one unique element! To select an element with a specific id, write a hash (#) character, followed by the id of the element. The style rule will be applied to the HTML element with id="unika", (in this case, #unika element will be height: 200px with a green background-color and 14 px font-size):

Example:
#unika {
height: 200px;
background-color: green;
font-size: 14px;
}

The class Selector

All the elements having that class will be formatted according to the defined rule. To select elements with a specific class, write a dot . character, followed by the name of the class. The style rule will be applied to the HTML element with class="box1", (in this case, box1 element will be height: 200px with a green background-color and 14 px font-size):

Example:
.box1 {
height: 200px;
background-color: green;
font-size: 14px;
}

Grouping Selectors

You can apply a style to many selectors how you like. Just separate the selectors with a comma as in the examples above.

Example:
h1, h2, h3, h4 { color: blue }

OK, so you've now learned about the CSS style syntax, but how do you incorporate this syntax into your website? The next lesson will show you how to incorporate CSS into your HTML webpage.

Syntax of CSS, How to Code CSS, Basic CSS Basic Syntax of CSS - How to Code CSS - css tutorial

3182. CSS Border Style Width and Color, css tutorial
CSS Border Style Width and Color css tutorial
https://www.agernic.com/css-tutorial/css-border-style-width-and-color.html

3189. CSS Text Style - Text Font Size - Text Align, css tutorial
CSS Text Style - Text Font Size - Text Align css tutorial
https://www.agernic.com/css-tutorial/css-text-style-font-size-and-text-align.html

3178. CSS code, Tags, Example, CSS, Editor, Online Courses, Training
Online CSS Tutorial pdf, what is CSS, Online Courses, Classes, Training, Tutorials for Beginners - agernic.com is a free interactive Code, Tags, Example, CSS, Editor, Online Courses, Training for beginners
https://www.agernic.com/css-tutorial.html

16. CSS3 Tutorial - An Ultimate Guide for Beginners
CSS Tutorials for Beginners - Learn the fundamentals of the latest CSS3 style sheet language in simple and easy steps and create beautifully designed website.
https://www.tutorialrepublic.com/css-tutorial/

825. Features of w3resource CSS tutorials

https://www.w3resource.com/css/what-you-will-learn.php

811. CSS border-top-style property - CSS tutorials - w3resource

https://www.w3resource.com/css/border/CSS-border-top-style-property.php

Your add here
How to get PHP errors to display?
How to prevent sql injection in php mysqli
How do I get PHP errors to display - PHP error_reporting()
mysql_query(): The mysql extension is deprecated and will be removed i
Function eregi_replace() is deprecated in php - How to fix
PHP delete an element from an array
Uncaught Error: Call to undefined function MYSQL_NUM_ROWS() in
Deprecated: mysql_connect() mysql extension is deprecated and will be
mysqli_fetch_array() expects parameter 1 to be mysqli_result boolean g
SQL IN Operator - example
SQL BETWEEN Operator
SQL like syntax and example
SQL WHERE AND & OR multiple conditions
SQL create table primary key autoincrement
PHP mysqli_connect () Function
SQL COUNT(), AVG() and SUM() Functions
Display data from SQL database with MySQLi into php - html table
SQL CREATE DATABASE - example
SQL mysql order by columns, by date, by asc, by desc, random with PHP
PHP mysqli_query() Function - mysqli query
SQL delete row - SQL delete table
SQL update - SQL update select
Insert into SQL - Insert into table SQL - Insert data in sql
Login in PHP - simple login script with PHP MYSQL