AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP, SQL

CSS Div Id Class


CSS Tutorial » CSS div id class


In the CSS to select elements class, write a "." (dot) character, followed by the name of the class
and an id selector is a name preceded by a "#" tag.


Syntax:

Syntax: id CSS.
#id_name { css declarations; }

Syntax: class CSS.
.class_name { css declarations; }

Note: use external CSS instead.

Different Id / Class Although both #id and .class can be used to style an html element. In practice, only the class attribute is used for this purpose. The id attribute is generally used in javascript to locate an html element and perform actions on it.

On the other hand, the id attribute must be unique on the page. This means that there cannot be another html element with the same id. The presence of several elements with the same id, can generate javascript errors and invalid html copy.

How to create div CSS id and class - examples


You can try to execute the following code to change div CSS id and class property of a text on this page.

Example:
Example 1, How to create div CSS id and class property - examples:

  <!DOCTYPE html>
<html>
<head>
<title>How to create div CSS id and class property - examples - example</title>
<style>
#first_box {
width: 380px;
border: 2px solid #00FF00;
text-align:right;
font-family: "Courier New", Courier, monospace;
font-size: 18px;
font-style: italic;
font-weight: bold;
color: #00CCFF;
text-decoration: none;
background-color: #CCCCCC;
}
.second_box { width: 276px;
text-align:left;
font-family: "Courier New", Courier, monospace;
font-size: 14px;
border: 2px solid #0000FF;
margin-top: 18px;
}
</style>
</head>
<body>
<div id="first_box"> <h1>How to create div CSS id and class property</h1> How to create div CSS id and class property - examples - example
<div class="second_box">How to create div CSS id and class property - examples - example.</div> </div>
<div class="second_box"> This div contains a very long word:
will break and wrap - thisisablablarylongwordblarylongwordblarylongwordblarylongwordblarylongword.
The long word will break and wrap to the next line.</div>
</body>
</html>
Note: Use external CSS instead.


css div id class, together, selector
CSS Div Id Class - css tutorial

Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


CSS Scrollbar Horizontal
CSS Scrollbar in Div
CSS Scrollbar Firefox
CSS Style Scrollbar
CSS Style Text
CSS background color
CSS Div Id Class
CSS Text Wrap
CSS text-align
CSS Text Decoration
CSS Text Shadow
CSS Text Color
CSS Text Bold
CSS Text Size
CSS background image full
CSS background opacity
CSS border radius
CSS rounded corners
CSS font color
CSS Class & ID
CSS align image center
CSS align content
CSS link color
CSS Text Style
CSS Text Font Size
CSS max width &height
CSS width and height
CSS Margin
CSS Padding
CSS Border Style
CSS background
CSS in HTML
Basic Syntax of CSS
CSS Introduction
Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


Upload Image, display, edit and delete i...
Login Form with Image background...
How to Create an Image with Transparent ...
Portfolio Gallery Website with filtering...
Simple pagination script PHP MySQLi...
Center Image in div...
Image Hover Overlay Fade...
Sticky image / element / div on scroll...
Responsive images...
Create rounded image in HTML CSS...
Add border around image...
Position Text Over an Image HTML CSS res...
Create a Slideshow Images Gallery...
Create a Sticky Sidebar...
Search bar using CSS HTML...
Shrink Navigation Menu on Scroll...
How to Create Accordion HTML Templates...
Dropdown menu in the navigation bar...
Responsive Top Navigation Bar with mobil...
Split horizontal navigation bar...