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

PHP forms
HTML Tutorial

CSS 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

2592. How to include, how to incorporate CSS in HTML, css tutorial
How to include, how to incorporate CSS in HTML css tutorial
http://www.agernic.com/css-tutorial/how-to-include-how-to-incorporate-css-in-html.html

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

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

813. CSS box model - CSS tutorials - w3resource

https://www.w3resource.com/css/concepts/box-model.php

2707. CSS Lists - CSS tutorial
EchoEcho.Com : The complete CSS tutorial
http://www.echoecho.com/csslists.htm

667. CSS tutorials - w3resource

https://www.w3resource.com/css/CSS-tutorials.php

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

Your add here
PHP lcfirst() function

PHP explode() function

PHP trim() function

PHP define() function

PHP strcmp() function

PHP print() function

PHP strtoupper() function

PHP md5() function

PHP substr() function

PHP count() Function

PHP str_replace() function

PHP str_split() function

PHP strstr() function

PHP str_repeat() function

PHP html_entity_decode() function

PHP strrchr() Function

SQL WHERE AND & OR multiple conditions
Deprecated: mysql_connect() mysql extension is deprecated and will be
HTML Tutorial - Tags and attributes
How to get PHP errors to display?
CSS Introduction Tutorial
Home HTML Tutorial