XHTML (Part 2)

Programming HOW TOs and in-depth guides for programmers of all levels. Programming is an essential skill for hackers, so start learning today!

XHTML (Part 2)

Postby crud3w4re » Tue Jan 30, 2007 9:32 am

Here's the minimum amount of tags you'll need to create a basic HTML document:

<html>
<body>
This is text.
</body>
</html>

Short and sweet. No header, just basic. So how easy HTML tags are? Once you understand the meaning of each HTML tag, then you can just pretty much do whatever the hell you want. Also, when you move onto other things, like javascript or PHP, remember, keep shelling out pure HTML/CSS templates once in awile, you don't want to be like "damn.. what's that tag again" lol.

So let's say you want to create a paragraph, what would you use? Well <p> yes, this is the paragraph tag, it works like this:

<html>
<body>

<p>Insert paragraph</p>
<p>Insert paragraph</p>

and so on ... This will create a new paragraph and the then you can begin typing in the text, end each paragraph tag with a </p>. Keep in mind, small errors in your HTML will show up when you want to verify your HTML, and there's things online that will verify your page, Google it.

What if you want to create large text? Small text? Okay! <h> tags = header tags, these will create larger or smaller text, but don't just use "<h>" this isn't an HTML tag, you'll need to document the value. So:

<html>
<body>
<h1>WEBSITE</h1>
</body>
</html>

This will create a very large n00bish text on the page, go see. Open notepad, type it in, save as "index.html" and you'll see what I'm talking about. It can go from:

<h1> largest text
<h2>
<h3>
<h4>
<h5>
<6> smallest text, got it?

So what if you want to break a line, but don't want to create a new paragraph?

Good question. A <p> tag creates a space in between the next paragraph, but a <br> tag just breaks the line and continues to the line right below, try it out in Notepad.

It has some purposes sometime's, I don't know, it's good if you don't want your text going across the screen of a site, but you don't want a new paragraph as well.

You can even leave yourself notes inside an HTML document, only you [and someone that views source] can read, you can do this by:

<!--Hmmm--> This will create a note to yourself, maybe you want to remember something.

Using <p> to create new lines is a bad habit, so use the <br> code instead, keep this in mind.

Another nice tag is the <hr> tag, it will create a line to create a new section in your site, it's pretty cool. You should try that out. This way, you can segment your site in different sections.

How do you center your site?

Okay, I'll show you. Let's say you want a "normal" large heading /// smaller text site, you'll need to use the following codes:

<html>
<body>

<h1 align="center">HEADING</h1>

<p>Paragraph</p>

</body>
</html>

Basically, you created a large heading, you aligned the text to the "center" and a <p> tag was used to create the body of the HTML document. Simple, eh?

How do I create background color?

Ohh want background color to your site, huh? Okay!

<html>
<body bgcolor="red">
<h2>Cool, it's Red!</h2>
</body>
</html>

Check it out. <body bgcolor="red> translates to the background (bg) color of the site will be red, and the <h2> is merely the size of the text that I used, this was explained earlier.

k. This was part 2, stay tuned for part 3! :D

crud3w4re
crud3w4re
n00b
 
Posts: 5
Joined: Mon Jan 29, 2007 3:37 pm

Return to ā€œ%sā€ Programming / Scripting Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests

cron