Showing posts with label HTML Web Page Code. Show all posts
Showing posts with label HTML Web Page Code. Show all posts
Tuesday, June 9, 2015
HTML Web Page Code-Inline Formatting
Hi Friends, Welcome to Technosaavy !
In the last post we discussed the block tags. So, let’s go for inline tags now.
As we have already seen how a few block tags work, let's try out another type of tags and this is called an inline tag. An inline tag is in line with the text and it doesn't creates a separate block of text, it just modifies a small portion. So let me just take a word in the middle of the sentence and I’ll just add a strong tag and off-course I’m going to add a close strong tag at the end and as we have already been familiar with this tag, it will make the text bold.
<!DOCTYPE html>
<html>
<head>
<title>try out text</title>
</head>
<body>
<h1>this is a heading</h1>
<h2>this is a sub heading</h2>
<h3>this is the next heading</h3>
<p>
Lorem ipsum dolor sit amet, <strong>consectetur</strong> adipiscing elit. Quisque sem quam, vehicula vitae sagittis eget, ornare id mi. Ut eleifend facilisis quam, in luctus erat laoreet in. Sed nec magna diam, et egestas augue. In fermentum sagittis tellus, interdum scelerisque turpis commodo quis. Curabitur iaculis tempor mollis.
</p>
<p>
Donec sed neque quis ligula ornare iaculis et eget urna. Nullam nec venenatis nisi. Sed tincidunt, elit facilisis lobortis congue, eros magna porttitor massa, non fermentum quam dolor quis risus.
</p>
<p>
Morbi volutpat vestibulum ligula, ut sodales urna suscipit non. Phasellus eu mauris massa, sit amet fermentum turpis. Vestibulum faucibus tincidunt orci vel tempor.
</p>
</body>
</html>
So, let's save our changes and go over and refresh the browser.
Now you can see that the word is indeed bolded and we haven't made a different block of text, we simply modified that piece of text inside the original paragraph block. Off-course another example of the inline tag that we saw earlier is the em tag. So, let's use that down in the second paragraph and again as you saw before I’ll add an em tag at the beginning of the word and the close em tag at the end of it.
<!DOCTYPE html>
<html>
<head>
<title>try out text</title>
</head>
<body>
<h1>this is a heading</h1>
<h2>this is a sub heading</h2>
<h3>this is the next heading</h3>
<p>
Lorem ipsum dolor sit amet, <strong>consectetur</strong> adipiscing elit. Quisque sem quam, vehicula vitae sagittis eget, ornare id mi. Ut eleifend facilisis quam, in luctus erat laoreet in. Sed nec magna diam, et egestas augue. In fermentum sagittis tellus, interdum scelerisque turpis commodo quis. Curabitur iaculis tempor mollis.
</p>
<p>
Donec sed neque quis ligula <em>ornare</em> iaculis et eget urna. Nullam nec venenatis nisi. Sed tincidunt, elit facilisis lobortis congue, eros magna porttitor massa, non fermentum quam dolor quis risus.
</p>
<p>
Morbi volutpat vestibulum ligula, ut sodales urna suscipit non. Phasellus eu mauris massa, sit amet fermentum turpis. Vestibulum faucibus tincidunt orci vel tempor.
</p>
</body>
</html>
Now we'll save our changes. And I expect when I refresh my page I’ll see some italicized text down here at the bottom.
Now as we are talking about the tags in context, let's try out a couple of other new tags. I'll go back to my chapter 2 working files folder and let's open the try-out-special-formats.html file in the browser to have a look at it and off-course in the notepad as we need to edit it.
<!DOCTYPE html>
<html>
<head>
<title>try out special formats</title>
</head>
<body>
<h1>indenting</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sem quam, vehicula vitae sagittis eget, ornare id mi. Ut eleifend facilisis quam, in luctus erat laoreet in. Sed nec magna diam, et egestas augue. In fermentum sagittis tellus, interdum scelerisque turpis commodo quis. Curabitur iaculis tempor mollis.
</p>
<p>
Donec sed neque quis ligula ornare iaculis et eget urna. Nullam nec venenatis nisi. Sed tincidunt, elit facilisis lobortis congue, eros magna porttitor massa, non fermentum quam dolor quis risus. Nullam tortor augue, pretium eget scelerisque in, feugiat id metus. Vivamus nec felis lectus.
</p>
<p>
Morbi volutpat vestibulum ligula, ut sodales urna suscipit non. Phasellus eu mauris massa, sit amet fermentum turpis. Vestibulum faucibus tincidunt orci vel tempor. Nullam dolor est, adipiscing et sagittis sed, tristique vitae tortor.
</p>
<h1>addressess</h1>
<p>Contact us here:</p>
<p>
123 Anystreet
Anytown, CA 99999
</p>
<h1>something written by robots</h1>
<p>
{alert(msg);return false;}}
else{document.captureEvt(Event.MOUSEUP);document
if (q.pagefile==2||q.pagefile==5)
(document.getElementID&&*!document.x)){
</p>
</body>
</html>
We can see that this file already contains the basic required html tags and some heading and paragraph tags that we are going to work with and all these are creating a formatting for us.
One thing we can do instead of using the heading or paragraph tags is using some of the specialty formatting tags. Let's try one out, there is one called blockquote; now I’ll replace the p tag of the middle paragraph with the blockquote and off-course the close tag with the closing blockquote.
<!DOCTYPE html>
<html>
<head>
<title>try out special formats</title>
</head>
<body>
<h1>indenting</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sem quam, vehicula vitae sagittis eget, ornare id mi. Ut eleifend facilisis quam, in luctus erat laoreet in. Sed nec magna diam, et egestas augue. In fermentum sagittis tellus, interdum scelerisque turpis commodo quis. Curabitur iaculis tempor mollis.
</p>
<blockquote>
Donec sed neque quis ligula ornare iaculis et eget urna. Nullam nec venenatis nisi. Sed tincidunt, elit facilisis lobortis congue, eros magna porttitor massa, non fermentum quam dolor quis risus. Nullam tortor augue, pretium eget scelerisque in, feugiat id metus. Vivamus nec felis lectus.
</blockquote>
<p>
Morbi volutpat vestibulum ligula, ut sodales urna suscipit non. Phasellus eu mauris massa, sit amet fermentum turpis. Vestibulum faucibus tincidunt orci vel tempor. Nullam dolor est, adipiscing et sagittis sed, tristique vitae tortor.
</p>
<h1>addressess</h1>
<p>Contact us here:</p>
<p>
123 Anystreet
Anytown, CA 99999
</p>
<h1>something written by robots</h1>
<p>
{alert(msg);return false;}}
else{document.captureEvt(Event.MOUSEUP);document
if (q.pagefile==2||q.pagefile==5)
(document.getElementID&&*!document.x)){
</p>
</body>
</html>
Let's save our changes and we'll go up and refresh our page and you can see that the center paragraph is indented slightly from the other two, if I resize the page, you can see that the indenting is still there.
So this is a typical blockquote text that's being called out different from the paragraphs around it. Interestingly enough you can stack up block texts so, let's go back to our document and I’m going to add the second blockquote tag by copying the first tag and pasting it after itself and off-course I need to make sure I have two close tags at the end as well so, I’ll copy that one and paste it at the end.
<!DOCTYPE html>
<html>
<head>
<title>try out special formats</title>
</head>
<body>
<h1>indenting</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sem quam, vehicula vitae sagittis eget, ornare id mi. Ut eleifend facilisis quam, in luctus erat laoreet in. Sed nec magna diam, et egestas augue. In fermentum sagittis tellus, interdum scelerisque turpis commodo quis. Curabitur iaculis tempor mollis.
</p>
<blockquote><blockquote>
Donec sed neque quis ligula ornare iaculis et eget urna. Nullam nec venenatis nisi. Sed tincidunt, elit facilisis lobortis congue, eros magna porttitor massa, non fermentum quam dolor quis risus. Nullam tortor augue, pretium eget scelerisque in, feugiat id metus. Vivamus nec felis lectus.
</blockquote></blockquote>
<p>
Morbi volutpat vestibulum ligula, ut sodales urna suscipit non. Phasellus eu mauris massa, sit amet fermentum turpis. Vestibulum faucibus tincidunt orci vel tempor. Nullam dolor est, adipiscing et sagittis sed, tristique vitae tortor.
</p>
<h1>addressess</h1>
<p>Contact us here:</p>
<p>
123 Anystreet
Anytown, CA 99999
</p>
<h1>something written by robots</h1>
<p>
{alert(msg);return false;}}
else{document.captureEvt(Event.MOUSEUP);document
if (q.pagefile==2||q.pagefile==5)
(document.getElementID&&*!document.x)){
</p>
</body>
</html>
Let's save our changes and we'll go back and take a look at our page.
Now you can see that it’s simply indented a little bit further. Now blockquote is very old tag and you may not find people using it as often as they did before but, we have a couple of other tags that can be really handy and they are contextual tags just like the emphasis and strong tags we saw before, and that's handling of addresses and code. So, let's go try these two now; for addresses we have a very specific tag. You can see that right now, I’m just using the paragraph tag so let's change that to address tag. I’ll need a close address tag at the end.
<!DOCTYPE html>
<html>
<head>
<title>try out special formats</title>
</head>
<body>
<h1>indenting</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sem quam, vehicula vitae sagittis eget, ornare id mi. Ut eleifend facilisis quam, in luctus erat laoreet in. Sed nec magna diam, et egestas augue. In fermentum sagittis tellus, interdum scelerisque turpis commodo quis. Curabitur iaculis tempor mollis.
</p>
<blockquote><blockquote>
Donec sed neque quis ligula ornare iaculis et eget urna. Nullam nec venenatis nisi. Sed tincidunt, elit facilisis lobortis congue, eros magna porttitor massa, non fermentum quam dolor quis risus. Nullam tortor augue, pretium eget scelerisque in, feugiat id metus. Vivamus nec felis lectus.
</blockquote></blockquote>
<p>
Morbi volutpat vestibulum ligula, ut sodales urna suscipit non. Phasellus eu mauris massa, sit amet fermentum turpis. Vestibulum faucibus tincidunt orci vel tempor. Nullam dolor est, adipiscing et sagittis sed, tristique vitae tortor.
</p>
<h1>addressess</h1>
<p>Contact us here:</p>
<address>
123 Anystreet
Anytown, CA 99999
</address>
<h1>something written by robots</h1>
<p>
{alert(msg);return false;}}
else{document.captureEvt(Event.MOUSEUP);document
if (q.pagefile==2||q.pagefile==5)
(document.getElementID&&*!document.x)){
</p>
</body>
</html>
Let's save our changes and see how that affects the text. Once I refresh the page you can easily see that it's just italicized but very importantly that very particular piece of content has been called out as an address.
So, any programs or applications that are scanning my page will actually know were the address is on the page. Now you can see that the context is much more important than how it looks on the page right now, we will do much to this text in our css chapter.
Now we have we have got a heading for "something written by robots". Very often in the page content you may need to call out a block of text that need special formatting to make it much easier to read, specifically if you got something like code. I'm currently displaying this code using the same font and style that we do for the other text styles and a normal text uses a variable width font meaning that the large letters are wider than the smaller ones. But, the code is often easier to read if you format it using a monospace font so, I’ll just go down to the code portion down here, I’ll change the p tag to a code tag and off course the close code tag.
<!DOCTYPE html>
<html>
<head>
<title>try out special formats</title>
</head>
<body>
<h1>indenting</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sem quam, vehicula vitae sagittis eget, ornare id mi. Ut eleifend facilisis quam, in luctus erat laoreet in. Sed nec magna diam, et egestas augue. In fermentum sagittis tellus, interdum scelerisque turpis commodo quis. Curabitur iaculis tempor mollis.
</p>
<blockquote><blockquote>
Donec sed neque quis ligula ornare iaculis et eget urna. Nullam nec venenatis nisi. Sed tincidunt, elit facilisis lobortis congue, eros magna porttitor massa, non fermentum quam dolor quis risus. Nullam tortor augue, pretium eget scelerisque in, feugiat id metus. Vivamus nec felis lectus.
</blockquote>
</blockquote>
<p>
Morbi volutpat vestibulum ligula, ut sodales urna suscipit non. Phasellus eu mauris massa, sit amet fermentum turpis. Vestibulum faucibus tincidunt orci vel tempor. Nullam dolor est, adipiscing et sagittis sed, tristique vitae tortor.
</p>
<h1>addressess</h1>
<p>Contact us here:</p>
<address>
123 Anystreet
Anytown, CA 99999
</address>
<h1>something written by robots</h1>
<code>
{alert(msg);return false;}}
else{document.captureEvt(Event.MOUSEUP);document
if (q.pagefile==2||q.pagefile==5)
(document.getElementID&&*!document.x)){
</code>
</body>
</html>
Let's save our changes and refresh the page.
Now you can see, that block of text is formatted using a monospace font and that makes it much easier to read this code’s individual element and syntax.
That’s all for the day in the next post we’ll discuss the line break and the special characters.
Have a Great Day Ahead !
Monday, May 18, 2015
HTML Web Page Code-Block Level Tags
Hello Friends! Welcome to Technosaavy !
In this lesson we are going to take a look at how to format our text content using HTML tags. Now I have got my working files open to the chapter two folder and just to get started I want to take a look at the try-out-text file, I will open it in the browser and in this case it's a big block of text up here at the top.
But, we'll be fixing that very soon, now I want to open that in our text application and here it's our code and we are ready to go.
<!DOCTYPE html>
<html>
<head>
<title>try out text</title>
</head>
<body>
this is a heading
this is a sub heading
this is the next heading
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sem quam, vehicula vitae sagittis eget, ornare id mi. Ut eleifend facilisis quam, in luctus erat laoreet in. Sed nec magna diam, et egestas augue. In fermentum sagittis tellus, interdum scelerisque turpis commodo quis. Curabitur iaculis tempor mollis.
Donec sed neque quis ligula ornare iaculis et eget urna. Nullam nec venenatis nisi. Sed tincidunt, elit facilisis lobortis congue, eros magna porttitor massa, non fermentum quam dolor quis risus.
Morbi volutpat vestibulum ligula, ut sodales urna suscipit non. Phasellus eu mauris massa, sit amet fermentum turpis. Vestibulum faucibus tincidunt orci vel tempor.
</body>
</html>
All my try out files are intended to be simple and have just the code we need to work with. You can see that we have some of the basic codes setup for the document....... Title, head and the body.
We can also see why our text is lumped up there at the top and that's because we don't have any HTML tag for formatting our content in the body. So, let’s see if we can fix that. I'll start by adding a paragraph tag right at the beginning of the paragraph section in the body and will do that at the beginning of rest of the sections as well. I'll just select the whole tag and then I’ll copy it and will just go to the beginning of the next section and paste in a new start tag, and again for the next section. Now as we saw in the earlier lesson the white space really doesn't matter here, so we can put the tag where ever we want. I tend to put it at the beginning of the short lines and I’ll put it above a larger block of text so, I’ll place it above the next few paragraphs then add in the closing paragraph tags that's </p> and again will copy that tag and paste it on the end of the other paragraphs, and off course we want to see our changes so, let's save our file and then we will go back over to our browser and just refresh the page.
Now we can see the separate blocks of text separated as they were intended. Now off course we are going to do a lot more than just separate blocks of text. As we can see from sample place holder here, these top three are actually intended to be headings and right now they just look like normal text paragraphs. So, let’s go back into our HTML document and let’s change that. Now the paragraph tags are acting as what we would refer to as block, they are blocking out the text and separating it from other text and we have got a number of other block tags we can use as well, some specifically for headings. I'm going to change the first one on our top heading and I’m going to change that <p> tag to an <h1> tag that's the top level heading and if we are going to have an h1 tag at the beginning of the block of text we better have a closed h1 tag at the end. Now as you might guess since there is an h1 tag we have got an h2 tag, h3 tag and they go over up to h6. So let’s set those on our two other subheadings here, I’ll make this an h2 tag and off course close h2 tag and will go for an h3 tag here at the next level heading. Let’s save our changes. And we will go back over and refresh our page.
And here we can see exactly what a heading is going to do, the heading tag takes the text in the blocks like it did with the paragraph tags but it also bolds the text and modifies the size. It also helps the reader to figure out basically what each type of content is.
Now our heading tags and our paragraph tags are doing something a little bit more than just formatting the text and breaking it up. They are actually formatting our content for lots of different types of media. For instance one major consideration while working on HTML sites is making sure that your site would be accessible to people with disabilities like visual disability, as they can't see a browser they will use a screen reader program to read the content to them. And that screen reader can actually also use the tags that we used to format the text, itself. The screen reader would know that an h1 tag is a big heading tag whereas an h2 tag is a subheading tag and the paragraph should be treated as content. So it's actually very important to use HTML tags properly to format our content not just so it looks good on the page but also so that servers and other applications will know what our content is, we they get to our page. One very important application that we usually care about is search engine. Search engines are going to look through the contents of our page and they are going to rank our page and set it up for searching based on what they have found. A great way to make sure that your document is going to work good in a search engine is to build it properly and to format it properly.
That's all for the day! In the next video we will take a look at the inline tags..........
Till then good bye and have a great day ahead!!!





















