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

3183. CSS Introduction Tutorial, css tutorial
CSS Introduction Tutorial css tutorial
https://www.agernic.com/css-tutorial/css-introduction-tutorial.html

2709. CSS Text - CSS tutorial
EchoEcho.Com : The complete CSS tutorial
http://www.echoecho.com/csstext.htm

2227. CSS Tutorial - Class and Id
To set a class of elements that share the same properties, the attribute with the same name will be used. On the other hand, you can also use elements id to add styles but it has some restriction when using it. Go on reading to find out more.
https://tutorialehtml.com/en/css-tutorial-class-and-id/

3300. CSS border radius, css tutorial
CSS border radius css tutorial
https://www.agernic.com/css-tutorial/css-border-radius.html

3180. CSS align image center - how to create, css tutorial
CSS align image center - how to create css tutorial
https://www.agernic.com/css-tutorial/css-align-image-center-how-to-create.html

667. CSS tutorials - w3resource

https://www.w3resource.com/css/CSS-tutorials.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