Saturday, May 13, 2017

HTML Basic Tags 2

Evening guys....welcome to these new tutorial section.....In this tutorial am gonna continue from where i stoped in the previous tutorial....In the last tutorial i talked about HTML basic tags and today am gonna round up with that topic...

Horizontal Lines
Horizontal Lines are used to break-up sections of a document.The <hr> tag creates a line from the current position in the document to the right margin and breaks the line accordingly.
For example you may wanna give a line between two paragraphs.

Example
<!doctype html>
<html>
<head>
<title>Horizontal rule example</title>
</head>
<body>
<p>This is the first paragraph</p>
<hr />
<p>This is the second paragraph</p>
</body>
</html>

You can try the above code out using your text editor for better understanding.
Like <br /> tag, the <hr /> tag is an example of empty element,where you do not need opening and closing tags,as there is nothing to go in between them.
 The <hr /> element has space between the hr character and the forward slash.If this space is omited older browsers will have trouble rendering the horizontal line,while if you miss the forward slash then it is not valid in XHTML.

Preserve Formatting
In some cases one would want the text to follow the exact format of how it is written in HTML document.In theses cases,you can use the preformatted tag <pre>.
In text between the opening <pre> and the closing </pre> tag will preserve the formatting of the source document..

Example
<!doctype html>
<html>
<head>
<title>Preserve formatting</title>
</head>
<body>
<pre>
function textfunction(strtext){
 alert(strtext)
 }
</pre>
</body>
</html>

You can try the above code out on your text editor for better understanding.

Nonbreaking Spaces
Suppose you want to use the phrase"12 Angry Men.",here you would not want the browser to split the "12,Angry" and "Men" between two lines

  In cases, where you do not want the client browser to break text, you should use a nonbreaking space entity &nbsp; instead of a normal space. For example, when coding the "12 Angry Men" in a paragraph, you should use something similar to the following code:

Example
<!DOCTYPE html>
<html>
<head>
<title>Nonbreaking Spaces Example</title>
</head>
<body>
<p>An example of this technique appears in the movie "12&nbsp;Angry&nbsp;Men."</p>
</body>
</html>

You can try the above code out for better understanding and if you are having issues learning then feel free to ask your questions using the comment box or send us a message using our live chat interface...

Thats it for this tutorial.....GOODLUCK and good night.

Links to previous tutorials on HTML : Html IntroductionHtml TagsHtml Document StructureThe Doctype Declaration , Html Basic Tags 
Share:

0 comments:

Post a Comment