Syntax
The <physique>
component sometimes follows the <head>
component. They’re “siblings”, and the 2 principal youngster components of the <html>
component.
Right here’s the standard syntax:
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
<head>
|
4 |
<title>Web page Title</title> |
5 |
</head>
|
6 |
<physique>
|
7 |
<!-- Seen content material goes right here -->
|
8 |
</physique>
|
9 |
</html>
|
Instance
Right here’s an instance of a easy HTML doc that makes use of the <physique>
component to outline the primary content material of the web page:
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
|
4 |
<head>
|
5 |
<title>My Web page</title> |
6 |
</head>
|
7 |
|
8 |
<physique>
|
9 |
<header>
|
10 |
<h1>Welcome to My Web page</h1> |
11 |
<nav>
|
12 |
<ul>
|
13 |
<li>
|
14 |
<ahref="#">Residence</a> |
15 |
</li>
|
16 |
<li>
|
17 |
<ahref="#">About Us</a> |
18 |
</li>
|
19 |
<li>
|
20 |
<ahref="#">Contact</a> |
21 |
</li>
|
22 |
</ul>
|
23 |
</nav>
|
24 |
</header>
|
25 |
<important>
|
26 |
<h2>About Us</h2> |
27 |
<p>
|
28 |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel enim vel nisl scelerisque convallis. Sed vel tellus vitae est sagittis eleifend. Duis euismod malesuada arcu id blandit. |
29 |
</p>
|
30 |
<h2>Contact Us</h2> |
31 |
<p>
|
32 |
123 Instance St<br />Theville, XX 12345<br />Telephone: 555-555-5555<br />E mail: |
33 |
instance@instance.com |
34 |
</p>
|
35 |
</important>
|
36 |
<footer>
|
37 |
<p>© 2023 Some Firm. All rights reserved.</p> |
38 |
</footer>
|
39 |
</physique>
|
40 |
|
41 |
</html>
|
On this instance, the <physique>
tag comprises the web page’s header, important content material, and footer.
Deprecated Attributes
The HTML <physique>
component traditionally has a number of attributes for specifying further details about the component.
These attributes have been deprecated in favor of CSS styling, and will now not be used.
-
bgcolor
: specifies the background colour of the web page. -
textual content
: specifies the default textual content colour for the web page. -
hyperlink
: specifies the colour of unvisited hyperlinks on the web page. -
vlink
: specifies the colour of visited hyperlinks on the web page. -
alink
: specifies the colour of lively hyperlinks on the web page.
Content material
The <physique>
component can comprise all kinds of content material, together with headings, paragraphs, lists, photos, movies, and extra. It’s sometimes used to outline the primary content material of a webpage.