Skip to main content

Html Styles

Html Styles 

This tutorial will help you to learn Html Styles and It is very easy to learn .You just follow my tutorial .Open your notepad and write code ,save it and see it in browser step by step.


Let's start.

Html style is used by web developers to add styles to an element, for example color

, font, size and more.

 

<!DOCTYPE html>

<html>

<body>

 

<p>This paragrah is without syle.</p>

<p style="color:red;">this is green color</p>

<p style="color:blue;">this is red color</p>

<p style="font-size:50px;">font siz is 50px.</p>

 

</body>

</html>

Browser result:

html styles


 

Style Attribute

The html style attribute is used to set the style of an element

It has the following syntax:

<tagname style="property:value;">

Now we are going to use this syntax and using some example will clear the concept.

Like we want background color , text size ,font and text alignment in our paragraph.

Background Color

Background color property is used to define background color for an element

 

<!DOCTYPE html>

<html>

<body style="background-color:blue;">

 

<h1>This is a heading</h1>

<p>This is a paragraph.</p>

 

</body>

</html>

Browser Result:

background color property in html styles


Fonts

Font-Family property will be used to define different fonts for an html element.

<!DOCTYPE html>

<html>

<body>

 

<h1 style="font-family:courier;">This is a heading</h1>

<p style="font-family:verdana;">This is a paragraph.</p>

 

</body>

</html>

Browser Result:

fontfamily property in html styles



Text Size and Text Color

Font-Size Property is used to define size for text and Color property for text color.

<!DOCTYPE html>

<html>

<body>

 

<h1 style="color:green;">This is a heading</h1>

<p style="color:red;">This is a paragraph.</p>

<h1 style="font-size:250%;">This is a heading</h1>

<p style="font-size:150%;">This is a paragraph.</p>

 

 

</body>

</html>

Browser Result:

Text Size and Text Color in html styles


Text Alignment

It is used to define alignment for Html element. Property is text-align.

<!DOCTYPE html>

<html>

<body>

 

<h1 style="text-align:center;">This heading is aligned as center.</h1>

<p style="text-align:center;">This paragraph is aligned as center.</p>

 

</body>

</html>

Browser Result:

Text Alignment property in html styles


I hope you like the post ,please don't hesitate to share my post to your friends. Thanks!!!



Comments

Popular posts from this blog

Top 5 mobile companies 2021

  Sometime in the past cell phone or wireless was viewed as an extravagance. Telecom organizations use to charge for both approaching and active call. Today the world has changed. We have advanced from First Generation of Mobile Phone Technology to the 5Th Generation. Presently, in many nations, telecom organizations charge for just cordial calls. Approaching calls are free.   Likewise, in the past there were not many rumored and confided in Mobile Phone Brands and Companies in the World. Brands like Motorola and Nokia managed the cell phone market. Because of innovative advancement and gigantic expansion popular, an ever increasing number of organizations have joined the cell phone fabricating business.   Prior cell phone handsets were basic and were implied uniquely to settle on and get telephone decisions and instant messages. With headway in innovation and less expensive call and information rates, straightforward component telephones are supplanted by cell phone. These cel

How create tables in html?

Html Table This tutorial will help you to learn Html Table and It is very easy to learn .You just follow my tutorial .Open your notepad and write code ,save it and see it in browser step by step. Lets Start. Html Table Table is used to store data in rows and columns. We will use example how can create a table in html Example   <!DOCTYPE html> <html> <body> <h2>Basic HTML Table</h2> <table style="width:100%">   <tr>     <th>Name</th>     <th>FatherName</th>      <th>Age</th>   </tr>   <tr>     <td>Ali</td>     <td>Abbas</td>     <td>50</td>   </tr>   <tr>     <td>Aslam</td>     <td>Ashraf</td>     <td>45</td>   </tr>   <tr>     <td>Mohsin</td>     <td>Ali</td> <td>40</td>   </tr> </table> </body> </html> Browser Result: <

Best and Top 5 Camera Brands 2021

  Regardless of whether you're purchasing your first computerized camera or updating your current photography gear, realizing the top camera brands in 2021 is fundamental. Picking the correct brand for you is significant in light of the fact that it will go far to molding your photography style and how you work out your unit. The brand you pick will likewise impact the nature of your gear and the scope of frill viable with it. We mean to make the determination cycle much simpler by showing you the best camera brands for advanced cameras. So how about we investigate the top camera brands accessible and what you need to know to settle on the best buying choice. Canon Odds are that in the event that you've at any point thought about purchasing another camera, the name Canon has come up.                                                        Photo by Tom Pumford on Unsplash   Canon has been making film and afterward advanced cameras since 1937 – a lot later in the