WDS6 - Style your Document
Tags: html, wds
Published: 2017-12-13 20:32:11

---
title: "WDS6 - Style your Document"
published: true
tags: HTML,WDS
canonical_url: http://thecodingexpress.blogspot.com/2017/12/wsd6-style-your-document.html
---

In the [last article](https://thecodingexpress.blogspot.in/2017/12/wds5-inspect-html-and-other-tags.html) 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:<script async="" src="//jsfiddle.net/TheCodingExpress/1u6x6tL7/1/embed/html,result/dark/"></script>  
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.  

### HTML \<pre\> Tag&nbsp;

**\<pre\>** 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.<script async="" src="//jsfiddle.net/TheCodingExpress/1yaewuj6/embed/html,result/dark/"></script>  

### HTML Style Attribute&nbsp;

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&nbsp; style attribute. Let's first see syntax of style attribute: <script async="" src="//jsfiddle.net/TheCodingExpress/9dt4hqq8/embed/html/dark/"></script>  
Now let's see some of the important properties you can use inside style attribute:  
  
**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Property&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Use**  

1. background-color&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; defines background color for that element
2. color&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; defines text color for that element
3. font-family&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; defines font used for given element
4. font-size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; defines size of text for give element
5. text-align&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; defines alignment of given element
Now let's see which values you can use for this properties.&nbsp;

For first two properties, you should enter any supported color as value. Modern browsers support **_140 named colors_**. You can see them at [http://htmlcolorcodes.com/](http://htmlcolorcodes.com/)&nbsp; . 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:
<script async="" src="//jsfiddle.net/TheCodingExpress/an75rk3q/embed/html,result/dark/"></script> 
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 \<style\> tag to enhance your content. Comment on how you think this article is, what improvements should I do and for any doubts. Share with your friends and _ **keep coding** _.