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

How to include, how incorporate CSS in HTML

One of the main features of CSS is flexibility and the different options it offers to perform the same task. In fact, there are three options for including CSS in an HTML document:
Include CSS in the same HTML document.
Define CSS in an external file.
Include CSS in HTML elements.

1. Include CSS in the same HTML document - How to add CSS to HTML in the same document.

CSS Styles are defined in a specific area of the HTML document. The HTML <style> tag is used and can only be included in the document header (only within the <head> section). This is one way - how to embed CSS in HTML.
Example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Example - How to add CSS to HTML in the same document</title>
<style type="text/css">
p
{ color: black;
font-family: Verdana;
}
.box1 {
height: 200px;
width: 400px
background-color: green;
font-size: 14px;
}
</style>
</head>
  <body>
<p>TEXT HERE - Include CSS in the same HTML document - How to add CSS to HTML in the same document.</p>
<div class="div-article-script">
<p>Your text here.</p>
Any text here
</div>
</body>
</html>

2. Define CSS in an external file - Another metod - how to include CSS in HTML

In this case, all CSS styles are included in a CSS file that HTML pages link using the <link> tag. A CSS file is nothing more than a simple text file whose extension is .css. You can create all the CSS files that are necessary and each HTML page can link as many CSS files as you need.
If you want to include the styles from the previous example in an external CSS file, you must follow a few steps:
1) A text file is created and only the following content is added:
p {color: black; font-family: Verdana; }, .box1 { height: 200px; width:400px; background-color: green; font-size: 14px; }
2) The text file with the name styles.css is saved. Special attention must be to the file having a .css extension and not .txt
3) The HTML page links the external CSS file using the <link> tag:

Exam

3. Include CSS in HTML elements - another way - how to incorporate CSS in HTML

The last method to include CSS styles in HTML documents is the worst way and the least used, since it has the same problems as the use of <font> tags.

Example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Example - Include CSS in HTML elements</title> </head>
  <body>
<p style="color: black; font-family: Verdana;">your text here</p>
</body>
</html>
This way of including CSS directly in the HTML elements is only used in certain situations in which a very specific style must be included for a single specific element.


How to include, incorporate CSS in HTML, How to add CSS to HTML, How to embed CSS in HTML, How to add CSS to a Webpage, Adding external CSS in an HTML file
How to include, how to incorporate CSS in HTML - 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.