Jump to content

XHTML

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
toxifyshadow

toxifyshadow

    Programmer

  • Members
  • PipPipPipPip
  • 125 posts
You might have seen weird html tags that look like <br />, and you might be wondering what their for. If thats true then I'm here to explian it to you.

XHTML is a cleaner, stricter version of html, it has the same tags and all, but those tags must have a closing tag!
by a closing tag I mean things like </font></body></script></style>etc...
What about <p>?
The paragraph tag is alittle different from html, it has the end tag, <p>Hello CodeCall</p>

And tags that normally don't have a closing tag?

With tags like <br><hr>etc..., at the end of those tags add a space and a slash like <hr />

What is it used for?

It is used for XML which stands for eXtensible Markup Language. In XML you define your own tags, such as <pet></pet><house></house>, there are no predefined tags, so you use XHTML.
Also about XML, don't use css to style it, there is a XML lanuage for it, look on w3schools.
It could also be used to keep your html clean.

Lists?
List may be confusing, you would think to use <li /> but really you use:
<li>A point</li>
<li>Cds</li>
<li>Milk</li>
<li>etc...</li>

Sorry about my mis-info I gave earlier, I did reserch and the correct way is <li>Bob</li>
Here is a page written in xhtml

<html><head><title>My XHTML Page</title></head>

<body>

<p>Welcome to my XHTML page!

I hope you enjoy it!</p>

<ul>

<h1>My list of pets!</h1>

<ol>

<li>Cat</li>

<li>Dog</li>

<li>Fish</li>

<li>Mouse</li>

<li>Water Snail</li>

</ol>

<br />

<hr />

<p>I hope you liked my example</p>

<br /><br /><br /><br /><br /></body></html>
If you have any more questions or comments please post them! :D

Edited by toxifyshadow, 13 April 2010 - 03:06 PM.

Posted Image

#2
semprance

semprance

    Programmer

  • Members
  • PipPipPipPip
  • 126 posts
I didn't realise you could place the content of the old-style li tags (like "<li>A point</li>") after a tag that opens and closes in the same token.

Does the tag and value have to be on the same line though? Or is it just everything that follows after "<li />" until the next opening tag?

Also have you got a stray "<ol>" tag in there? Not sure if it was intentional but I don't think it gets closed anywhere.

#3
toxifyshadow

toxifyshadow

    Programmer

  • Members
  • PipPipPipPip
  • 125 posts

semprance said:

I didn't realise you could place the content of the old-style li tags (like "<li>A point</li>") after a tag that opens and closes in the same token.

Does the tag and value have to be on the same line though? Or is it just everything that follows after "<li />" until the next opening tag?

Also have you got a stray "<ol>" tag in there? Not sure if it was intentional but I don't think it gets closed anywhere.

Opps, I ended ol with ul, thanks. It was accidental.
Also, becuase xhtml is a much stricter version or html, I would suggest keeping the tag and value on the same line, I'm not sure if it will error or anything but I would suggest to keep <li>A point</li> on the same line.
If it is possible to do <li /> then multi-line might be ok, I haven't worked much with lists, sorry.
Posted Image

#4
semprance

semprance

    Programmer

  • Members
  • PipPipPipPip
  • 126 posts
Trial and error then I guess. I'll give it a try next time I'm editing a page with lists on. Cheers for the tips anyhow.

#5
toxifyshadow

toxifyshadow

    Programmer

  • Members
  • PipPipPipPip
  • 125 posts
Actually I just did reserch, use <li> A point </li>
Edit: Sorry this post was simple I never realised you were online so I did some list reserch and the correct way is

<ol>

<li>Milk</li>

<li>Cheese</li>

<li>Bread</li>

</ol>

Not sure about multi-line though, I would stick to 1 line.
Posted Image

#6
semprance

semprance

    Programmer

  • Members
  • PipPipPipPip
  • 126 posts
Ah ok, that's how I normally do a list.

#7
toxifyshadow

toxifyshadow

    Programmer

  • Members
  • PipPipPipPip
  • 125 posts
:cool:
Posted Image