Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

WDS6 - Style your Document

In the last article we learned:
  • Rules about using Html headings
  • Horizontal Rule in HTML
  • How to Inspect webpages to view their HTML
Now let's move towards one very important flaw of HTML:
We all studied about paragraph element in previous posts which help to create a paragraph simply, but do you notice one big problem with it? Let's see with one example:
The above two code snippets have different inputs but same output. Why?
With HTML, you cannot change the output by adding extra spaces or extra lines in your HTML code.The browser will remove any extra spaces and extra lines when the page is displayed.
But there is the solution.


tag is used for displaying preformatted text which means it will display output same as-as formatting in your input and will not remove extra spaces.

HTML Style Attribute 

Although what I will you tell now, you will never use after you learn CSS. In this part we will study how you can style content in HTML using  style attribute. Let's first see syntax of style attribute:
Now let's see some of the important properties you can use inside style attribute:

             Property                                    Use
  1. background-color            defines background color for that element
  2. color                        defines text color for that element
  3. font-family                   defines font used for given element
  4. font-size                    defines size of text for give element
  5. text-align                    defines alignment of given element
Now let's see which values you can use for this properties. 
For first two properties, you should enter any supported color as value. Modern browsers support 140 named colors. You can see them at  . For font-family you should enter any valid fonts supported by browsers.For font-size , you can enter size in percentage(%) or pixels(px). For text-align, alignment can be left, right or center.
Let's finally one example combining all above concepts:
That's all for this article. I hope you all are practising what you are learning here because Practise is key to success. In the next part, we will learn about some other ways beside

This post first appeared on The Coding Express, please read the originial post: here

Share the post

WDS6 - Style your Document


Subscribe to The Coding Express

Get updates delivered right to your inbox!

Thank you for your subscription