NameSilo

<Div> tags

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch

sin

VIP Member
Impact
130
Just wondering why people use so many div tags in their websites, does it help loadtime or something?
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
JYM said:
The moral of the story is... there's hardly anything you can't do with CSS right now. In fact, you should stop coding a website by making divs that look like tables, but rather make each content box or area its own element.
I find it a lot harder to organize, maybe I just don't know how to do it yet, to make a table fit snuggley right under or next to another table is quite easy ;) but for div's I have some difficulty.

If I had one huge div (800wide) to hold the entire main structure of the site, I would have trouble makeing 2 div's on the left (one under the other) and 2 on the right side (just like the left) and one in the middle. But with a table its easy :)
Maybe I should play around with alignment in the css stuff... I'm still finding new things to do with css ;)

Thanks guys, Im glad I started using divs :tu: still learning:hehe:
 
0
Close
Jeff, you should take a look at this site: http://blog.html.it/layoutgala/

It contains 40 different layouts which are either fixed or liquid, and works in all browsers. Just take a look at the code and you will begin to understand it better. The first time I coded with divs, I did it in the same way I would code a table with the exception that I used the div tags. Actually, now that I think about it... my layout was a very difficult one to code as it was designed for tables.

Personally, I find it much easier to move things around and to add more boxes with CSS than it is to do with tables. Whenever I wanted to add another content box, I'd have to open photoshop, expand the canvas, add another content box, slice it, and then start recoding. I just never took the time to fully grasp tables I suppose.

I'd suggest reading some tutorials, looking at layouts, and just experimenting. The CSS reference @ w3schools.com is very helpful too when you are beginning.
 
0
Close
JYM said:
I'd suggest looking at layouts, and just experimenting.
I download and look at em, but I dont steal anything from em. ;) I do this a lot and have noticed that about 80% are mostly <div>s so I actatually just figured that they load faster, because everyone uses them. :lol:
I've downloaded and look at + experimented with atleast 40 different templates from sites that I like ;) . I learned quickly but downloading their external style sheets and messing around with bare code, - I did'nt have a fun time doing.

I know (now, since I posted this thread) how easy it is to edit css in dreamweaver.

p.s. that link is pretty intresting all the different combinations and stuff :) thx
 
0
Close
Actually I don't think there's much of a difference between load time. It's more that normally using tables, you have more code, which takes longer to load. In addition, with CSS you can make your more important items closer to the top of the HTML so they start loading first, since with CSS absolute positioning you can put elements wherever.

For liquid layouts, do not use the position attribute. My layout, www.jymweb.com/puredl, doesn't use the position once so if a box above another stretches, it will automatically shift positions like in a table.

Feel free to take apart my code and CSS..
 
0
Close
When I first noticed all these sites were using div tags' (this may not be accurate), but I thought that it let the parts of the page load on their own. Like some small image at the bottom will showup before the big header image. Or everything will showup and then the bigger images.
Because my site was having a problem, it would just show the background and then everything would show up. (took like 5-7 seconds) And I have a fast connection. And I see these other sites that use <div>s where everything shows up and then the images show up.

What's the deal with that if it wasn't the fact that I use tables and they used divs?
 
0
Close
Well actually...there is some truth to that. If I remember correctly a table doesn't display until all of the table is loaded (this is because the browser doesn't have all the information it needs to complete the table until it recieves the whole thing).

Also a nice thing about div tags is that you can arrange your site any way you want any time you want. This makes it easy to create themes (even ones where there are more changes happening than just color changes!!!).
 
0
Close
help again :)

hmm I have another problem with div tags now, if you click here You will notice that if your running firefox that the firends(red header) and the friends list(gray) are seperated, in IE it works fine... Why does it mess up in firefox.
thanks
 
0
Close
Actually, if you preview your site with IE, you will run into many problems. Firefox is the best browser for CSS and Opera displays things almost the same. It is with IE that you run into problems, which is why some people are hesitant in converting to CSS because you will need hacks just for IE.

The reason it probably works in IE is because padding and borders are different. In IE, the padding and border are a part of the element's width, where as in Firefox it adds it on.

Also, you can condense all those border styles into one:
Code:
#asdf {
        border: 1px solid #000;
}
 
0
Close
this is the code that I have,
---------------
<td width="160" align="center" valign="top"><div class="leftfriends">Friends</div><div class="friendslist">
<p>a <br>
a<br>
a<br>
a<br>
a<br>
a<br>
<br>
</p>
</div>
------------------------
And the style is this
------------------------
.leftfriends {
border: 1px solid #330000;
width: 150px;
background-color: #BD3B35;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
color: #FFFFCC;
text-align: left;
text-indent: 5px;
filter: Blur(Add=55, Direction=90, Strength=99);
}
.friendslist {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-style: normal;
background-color: #D8D8D8;
text-align: left;
width: 150px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-right-color: #330000;
border-bottom-color: #330000;
border-left-color: #330000;
}
---------------------------------------
Hmm, I'm still not sure why they get seperated in firefox :(

brianmn said:
a table doesn't display until all of the table is loaded
What if I had a big table, inside was a smaller table with some text in it. And two <div> areas inside the first div area was a large(file size) picture and inside the 2nd div was a small (file size) picture.
If someone goes to my site will they see the small picture before the text? Or the whole thing at once.
BUT
If instead of "a big table" I had one big <div> and then one table and 2 more div's inside what would happen
 
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

New: watch any domain
You can now watch domains on NamePros. We check each one and notify you when something changes. Search for a domain and press Watch on...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back