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

PHP forms
HTML Tutorial

CSS Tutorial

HTML div style - div style class


<< Previous Page
HTML Text and Paragrafs
Next Page >>
HTML Colors



HTML Tutorial » HTML Style

Inserting a style for div style there are three ways:
External style sheet,
Internal style sheet,
Inline style,
For any <div> on your page, you can specify any CSS property as: color, font-style, font-family, font-size, background, etc.

Inline html div style


Here in example 1 we give css to div of height, width, background and color.

Example 1:
<div style="height:300px; width:450px; color:#000000; background:#CCC"> Add your text here</div>
Note: try to avoid inline-css, you have to make external HTML div style.

Internal and external style of html div


You can archieve same using Internal or External CSS
1. Internal style for html div.
Example2:
<html >
<head>
<style>
div {
height:50px;
width:50px;
background-color:red;
}
</style>
</head>
<body>
<div> Here your text</div>
</body>
</html >

2. External style for html div.
Example 3: named index.html and we add external file named style.css in Example 4.
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div></div>
</body>
Example 4 named style.css
div
{
height:350px;
width:450px;
background-color:red;
color: #000000;
}


HTML div style class


The HTML div style class attribute is used to define equal styles for item with the same class name.
So, all HTML div style class item with the same attribute will have the same format and style.
Here we have three HTML <div> class elements that point to the same class name:
Example 5:
<!DOCTYPE html>
<html>
<head>
<style>
.town {
  background-color: #CCC;
  color: #000000;
  margin: 12px;
  padding: 15px;

</style>
</head>
<body>

<div class="town">
  <h2>ROMA</h2>
  <p>ROMA is the capital of Italy.</p>
</div>

<div class="town">
  <h2>MADRID</h2>
  <p>Madrid is the capital of Spain.</p>
</div>

<div class="town">
  <h2>SEOUL</h2>
  <p>Seoul is not the capital of Japan.</p>
</div>

</body>
</html>
Note. Use External style sheet


<< Previous Page
HTML Text and Paragrafs
Next Page >>
HTML Colors


HTML div style, div style class HTML div style - div style class - html tutorial

3210. HTML Tutorial - Tags and attributes, html tutorial
HTML Tutorial - Tags and attributes html tutorial
https://www.agernic.com/html-tutorial/html-tutorial-tags-and-attributes.html

2605. HTML Tutorial
HTML tutorial
http://www.echoecho.com/html.htm

2204. HTML Tutorial - Meta-Tags (Stichwörter, Neu laden, überarbeitet...)
Meta-Tag, wie man das Meta-Tag verwendet. Warum sind Meta-Tags bei SEO so nützlich.
https://tutorialehtml.com/de/html-meta-tags/

3058. HTML Image Maps
Learn about HTML image maps with this HTML tutorial.
https://www.quackit.com/html/tutorial/html_image_maps.cfm

3051. HTML Colors: How to add Color to your Web Page
Learn about HTML colors with this HTML tutorial.
https://www.quackit.com/html/tutorial/html_colors.cfm

2139. HTML Tutorial - Lists Creating and using them
Lists in HTML, Taggs to create a lis
https://tutorialehtml.com/en/html-tutorial-lists/

Your add here
PHP isset() Function

PHP trim() function

PHP print() function

PHP printf() function

PHP wordwrap() function

PHP str_repeat() function

PHP similar_text() function

PHP ucfirst() function

PHP strip_tags() function

PHP strtolower() function

PHP implode() function

PHP empty() Function

PHP ucwords() function

PHP html_entity_decode() function

PHP substr() function

PHP htmlentities() function

CSS Text Size
CSS Padding, top, bottom, left, right
HTML List Style Type
CSS font color
SQL tutorial will teach you how to use SQL - Database
CSS background, Color, Background Image