Jump to content

I'm relatively new with a few questions (divs, floats)


krakestraw

Recommended Posts

Hi, i'm relatively new to web design. I have already read one book, which is a little outdated. I'm am about to start on javascript soon.

Anyways, I was wondering if there is some sort of template or setup you use when coding a page as far as divs go. They seem to be confusing once

you get a lot of them in the code. Do you have more than one wrapper div? (ex. 1 around the heading div, 1 around the main content div, ect.) or do you

just have one wrapper/container div around all the content? It's hard to get out what exactly i'm trying to say lol.

 

Also, on the float property, is it, or positioning better for layouts?

 

One more question, I've seen where some people use ul and li for layout instead of using them for actual list.

Is that a good technique? or just bad practice? Can someone shed some light on this? If it is a decent technique can someone explain to me how i would

use that for layout?

 

I appreciate any answers i get! Sorry i have so many questions.

Link to comment
Share on other sites

Anyways, I was wondering if there is some sort of template or setup you use when coding a page as far as divs go. They seem to be confusing once

you get a lot of them in the code. Do you have more than one wrapper div? (ex. 1 around the heading div, 1 around the main content div, ect.) or do you

just have one wrapper/container div around all the content? It's hard to get out what exactly i'm trying to say lol.

As few as you can. Some people get "divitis" using divs everywhere and lots nested inside others which are nested inside others. However, it is a good idea to have one page wrapper because you may want to center the whole page in wide windows and a page wrapper makes that easy. Most developers would have a div for the header and another for the footer if there are several items inside, like a logo, title and menu (although a new HTML5 structure would use the new <header>, <section> and <footer> tags instead of <div> tags).

Also, on the float property, is it, or positioning better for layouts?

Generally try to use floats (which are part of a position: relative structure) with margins to keep a space between them and an adjacent floated div, instead of position; absolute with top, left, right or bottom positions. It should make a more fluid layout.

One more question, I've seen where some people use ul and li for layout instead of using them for actual list.

Is that a good technique? or just bad practice? Can someone shed some light on this? If it is a decent technique can someone explain to me how i would

use that for layout?

Lists using ul and li tags are just one method of structuring a page, often used for menu tabs. Most content would normally be in divs; list tags are for lists or short bits of content in a line or vertically.

Edited by Wickham
Link to comment
Share on other sites

As few as you can. Some people get "divitis" using divs everywhere and lots nested inside others which are nested inside others. However, it is a good idea to have one page wrapper because you may want to center the whole page in wide windows and a page wrapper makes that easy. Most developers would have a div for the header and another for the footer if there are several items inside, like a logo, title and menu (although a new HTML5 structure would use the new <header>, <section> and <footer> tags instead of <div> tags).

 

Generally try to use floats (which are part of a position: relative structure) with margins to keep a space between them and an adjacent floated div, instead of position; absolute with top, left, right or bottom positions. It should make a more fluid layout.

 

Lists using ul and li tags are just one method of structuring a page, often used for menu tabs. Most content would normally be in divs; list tags are for lists or short bits of content in a line or vertically.

 

 

 

Thanks for the information and for getting back to me so soon. That just about summed everything up! I appreciate it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...