HTML Style Attribute || HTML Tutorial || Code With Neha

Опубликовано: 30 Январь 2025
на канале: Code With Neha
207
5

In my previous video of html series I have discussed about p tag

Today I am going to discuss about html style attribute

HTML style attribute is used to add styles to an element, such as color, font, size, and more.

Setting the style of an HTML element, can be done with the style attribute.

The HTML style attribute has the following syntax:

tagname style="property:value;"

The property is a CSS property. The value is a CSS value.

Background Color

The CSS background-color property defines the background color for an HTML element.

Let's us see with an example

Creating a web page with basic html tags
Here styling the body tag as body style="background color:skyblue;"

H1 and p as heading and paragraph tag

Save the changes And here it is

We can change background color of h1 and p as well


2)Text color

The CSS color property defines the text color for an HTML element:

Just changing the attribute as color instead of background color for font color

3)Fonts

The CSS font-family property defines the font to be used for an HTML element:

Consider H2 as the 2nd heading

H2 style =" font- family =monospace;"

4)Font-size

The CSS font-size property defines the text size for an HTML element

h2 style= "font-size= 200%"

5)Text Alignment

The CSS text-align property defines the horizontal text alignment for an HTML element

Consider h3 as 3rd heading

So changing the text align of 3rd heading

h3 style="text-align:center;


That's it for today
Hope you all will get some help from this video If it's so then don't forget to subscribe my channel Code with Neha and press the Bell Icon to never miss an update
See you in the next video till then Stay Safe Stay Happy




#htmlbasics
#htmltutorial
#htmltags
#learnhtml
#htmltutorialforbeginners
#html5Tags
#tagsinHTML
#htmltutorial
#htmltutorialforbeginners
#htmlcss
#htmlcode
#html
#HTML5
#htmltags
#htmlattributes
#htmlelements
#htmltutorial
#htmltutorialforbeginners
#webdevelopment
#webdev
#webdesign
#htmlforbeginner
#htmlforbeginners
#coding
#htmlstyle
#htmlstyletag
#htmlstylecss
#htmlstyleattribute
#htmlstylesheet
#htmlstyletagtutorial
#htmlfontstyleattribute
#htmltextalignment
#htmlfont
#htmlbackgroundcolor
#htmlbackgroundcolortag
#htmlbackgroundcolorandtext
#htmlcolor
#htmlcolortag
#htmlfontcolortag
#htmlfontsize
#htmlfontsizetag
#htmlcssfontsize
#htmlcodeforfontsizeandcolor
#htmlfontfamily
#htmlfontfamilycode