HTML Style Attribute

With the HTML style attribute, you can change the size, colour, font, and other styles of an element.

The Style Attribute of HTML

The style attribute can be used to change the style of an HTML element.

The HTML style attribute is written in this way:

<tagname style=\”property-name:attribute-value;\”></tagname>

The Example is made with CSS. A CSS value is what the value is.

<!DOCTYPE html>
<html>
<body>

<p>Normal text</p>
<p style=\”color:red;\”>Red Text</p>
<p style=\”color:green;\”>Green text</p>
<p style=\”font-size:70px;\”>Big text</p>

</body>
</html>

Output

\"css

In the rest of this tutorial, you will learn more about CSS.

Color of the background

The background colour of an HTML element is set by the background-color property of CSS.

Example

<!DOCTYPE html>
<html>
<body>

<p>Normal text</p>
<p style=\”background:red;\”>Red Text</p>
<p style=\”background:green;\”>Green text</p>
<p style=\”font-size:70px;\”>Big text</p>

</body>
</html>

Output

\"Background

Related Posts
Introduction to HTML

HTML Introduction HTML is the most common language used to mark up Web pages. What does HTML mean? Hyper Text Read more

What is HTML

HTML stands for Hyper Text Markup Language, which is a programming language used to make web pages and web apps. Read more

HTML Basic Examples

In this chapter, we\'ll show you some simple examples of HTML code. Don\'t worry if we use tags that you Read more

HTML text Editors

Editors for HTML text HTML files are text files, so any text editor can be used to make them. Text Read more

HTML Tags

Learn HTML Tags HTML tags are kind of like keywords that tell a web browser how to format and show Read more

HTML Elements

Elements make up an HTML file. These elements are what make web pages and tell you what content is on Read more

HTML Attributes

Attribute in HTML Attributes in HTML are special words that tell you more about an element. Attributes change the way Read more

HTML Headings

Headings in HTML The <h1> to <h6> tags are used to set up headings in HTML. <h1> shows which heading Read more

Scroll to Top