Jump to content

Help With the <div> Tag?


Luke4123

Recommended Posts

Hey guys. Can you please explain how I can use the div tag and what you do with it? Thanks in advanced. :)

Link to comment
Share on other sites

You could look this up, I think. But--A div is simply a blocklevel container.Blocklevel means that you don't put it in the middle of a sentence or a list. Instead, it holds other things, like lists and text and forms and images and so on. It can have borders, background images, background colors, etc.You can put one or more divs inside another.Among experienced designers, groups of divs have replaced the table as a way of laying out elements. It is more flexible, requires less markup, and can be positioned with pixel accuracy. Nested divs can be used for things like menus.Hiding and then showing divs makes the div natural for this and also for message boxes and simulated dialogs.You can almost think of a div as a little frame or window that will hold anything you want to put in it. The big difference is that it doesn't get its "source" from an outside file (although technically this is possible to achieve.)

Link to comment
Share on other sites

As Deirdre's Dad posted, this is exactly right, and here is an example to go with it if you are unsure of what you mean by them being nested.. or anything else[LINK]and if you want to see the CSS for it to see how it is done...[LINK]

Link to comment
Share on other sites

Thanks for that. :) Do you have like an example?

Link to comment
Share on other sites

Oh sorry about that. :) I'm sorta getting it now. Another question, what is <!DOCOTYPE ? If I am making a website, do I need to use that at all?

Link to comment
Share on other sites

<!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

like that is used for validating your site, which is a MUST when making a site, if you want your site to be worth anything at all, other than a piece of junk, having a site validate is a great thing, and all of my sites validate.Seriously, for me, if it doesn't validate, it doesn't go on the web....W3schoolsa link on the HXTML DTD, and as if you read it says <!DOCTYPE> Is Mandatory

Link to comment
Share on other sites

The DOCTYPE is the tag that defines your documents type via its DTD (so, whether it is HTML, XHTML, MathML, RSS, etc). The DOCTYPE declaration is useful because it helps the browser render (and parse) your page correctly. Without it some things may look strange on your page. So... it is not necessary per se but it is useful and all pages should have one.

Link to comment
Share on other sites

Oh ok. So if my site that I'm making is CSS, and the link is www.olsen.com.au/luke, what would it say?

Link to comment
Share on other sites

Your site would be HTML, not CSS (DTDs (Document Type Declarations / DOCTYPES) are for markup-based languages, not CSS). Have you made it XHTML compatible?

Link to comment
Share on other sites

Yea, your site would be created in XHTML/PHP, or something of the sort....CSS would be used just for styling of your site...

Link to comment
Share on other sites

Yeah its HTML made. So what would the DOCOTYPE be?

Link to comment
Share on other sites

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Link to comment
Share on other sites

But my site isnt W3Schools. :)

Link to comment
Share on other sites

The http://www.w3.org/TR/html4/loose.dtd bit tells the browser where the DTD file (the thing which describes what can be in the document) is located. Go there and see.By the way:W3/W3C = World Wide Web Consortium, which "develops interoperable technologies (specifications, guidelines, software, and tools) to lead the Web to its full potential."W3S = W3Schools, tutorial site for web technologies developed by the W3C.

Link to comment
Share on other sites

div tags are used as layers. They are nowdays most widely used. They are the resemblance to the table tag. The difference between table and div is that div can be inserted anywhere like over a text and more, there is level of topping the layers by z-index css tag.More to learn goto the w3schools website.

Link to comment
Share on other sites

Here is the full list of doctypes to choose from:http://www.w3.org/QA/2002/04/valid-dtd-list.htmlI would recommend using HTML 4 strict, but whatever you use make sure that once you put your page online you run it through the validator to make sure that your code adheres to the rules that the doctype says it needs to. Doctypes are essentially a list of rules that your page needs to follow. This is the validator that the W3C runs:http://validator.w3.org/

Link to comment
Share on other sites

  • 2 weeks later...
Here is the full list of doctypes to choose from:http://www.w3.org/QA/2002/04/valid-dtd-list.html This is the validator that the W3C runs:http://validator.w3.org/
Just copy and paste the doctype you need. It's kind of like a set of boilerplate contracts, they can't be changed.You don't have to put your page online to run it through the HTML validator. You should periodically validate your code, as you write it. Either 'Upload by File' or cut and paste the code from your computer rather than waiting until it's ready to FTP to the server. You can also validate your CSS: http://jigsaw.w3.org/css-validator/If you are just starting to learn to write page code, I would recommend learning the most current (XML influenced) markup, XHTML 1.1 and the most current style sheet CSS 2.1. It's looking like Web 2.0 will be heavily reliant on XML. Most RSS feeds are XML already.W3C is developing XHTML 2, CSS 3, as well as HTML 5.
Link to comment
Share on other sites

It's kind of like a set of boilerplate contracts, they can't be changed.
Actually if you wanted to you could create a custom DTD with other elements / attributes (such as is suggested in this ALA article - http://www.alistapart.com/articles/customdtd/ ), then change the doctype tag to <!DOCTYPE html SYSTEM "yourcustomdtdurl">
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...