Tutorial

How To Style the HTML <body> Element

Updated on August 9, 2021

Senior Manager, DevEd

How To Style the HTML <body> Element

The HTML <body> element is a semantic element that tells the browser that its content is part of the body of the webpage and intended for display. In this tutorial, we will add a <body> element to our web document where we can add content later on.

To add a <body> element to your document, insert opening and closing <body> tags after the closing </head> tag but before the closing </html> tag. Your document should now have the following code:

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <title>Sammy’s First Website</title>
  <link rel="shortcut icon" type="image/jpg" href=”Favicon_Image_Location”/>
</head>

<body>
</body>

</html>

You should now understand the purpose of an HTML <body> element and understand how to add one to your HTML file.

In the next step, we’ll begin to add our website content in between the <body> tags.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products


Tutorial Series: How To Build a Website with HTML

This tutorial series will guide you through creating and further customizing this website using HTML, the standard markup language used to display documents in a web browser. No prior coding experience is necessary but we recommend you start at the beginning of the series if you wish to recreate the demonstration website.

At the end of this series, you should have a website ready to deploy to the cloud and a basic familiarity with HTML. Knowing how to write HTML will provide a strong foundation for learning additional front-end web development skills, such as CSS and JavaScript.

About the authors
Default avatar

Senior Manager, DevEd

Open source advocate and lover of education, culture, and community.

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
1 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Can we use direct styles in HTML ?

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.