w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



style ... ⁄style, optional element

The style element is optional.

Note: If you do not wish to use the style element to style your web page, you can save all the CSS rules in a cascading style sheet (.css) and link this file to your html page through link element (exemplified in the video tutorial below).

Valid Syntax 1
style element present
1
2
3
4
5
6
7
8
9
10
11
12
<!doctype html>
<html>
<head>
<title>...<⁄title>
<style>

<⁄style>
<⁄head>
<body>

<⁄body>
<⁄html>
Valid Syntax 2
style element absent, style optional
1
2
3
4
5
6
7
8
9
10
11
12
<!doctype html>
<html>
<head>
<title>...<⁄title>



<⁄head>
<body>

<⁄body>
<⁄html>

Video demonstration style, optional element

HTML5 style, optional element Tutorial

min video details
00:11 style element is optional:

You can choose:
1. not to style your page, at all OR
2. to style it through link element
00:18 1. page without style
00:18 removing the style element =>
the page is no longer styled
00:20 test result: ok
00:27 2. styling the page through another html element: link
00:29 copy ⁄ paste the CSS rules from style element in an external stylesheet
00:31 naming & saving the external style sheet
00:37 the external style sheet "style.css" has been created
00:43 removing style element from page
00:45 linking the external style sheet "style.css" to our index.php page through link element
00:56 the same result obtained; the html page is styled again, without using the style element but link element
style intro style browser display style parents - CSS rules style ELEMENT vs style ATTRIBUTE style syntaxstyle media attributestyle type attributestyle scoped attributestyle title attribute