Closed Thread Icon

Preserved Topic: div for dummies (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=20453" title="Pages that link to Preserved Topic: div for dummies (Page 1 of 1)" rel="nofollow" >Preserved Topic: div for dummies <span class="small">(Page 1 of 1)</span>\

 
silence
Maniac (V) Inmate

From: soon to be "the land down under"
Insane since: Jan 2001

posted posted 02-28-2002 07:24

I was wondering if anyone could explain the div tag to me. So far, I know you can use the align option with it and that you can use it with CSS. I assume the code would just be:

<div class="something">

Are there any other unique uses for the tag or unique ways of using it as I understand it?

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 02-28-2002 08:09

It's basically a block version of <span>. You can set all of the usual parameters, including width, height, visibility, border, padding, margin, etc....

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 02-28-2002 14:50

The advantage is that it doesn't come with any pre-defined look about it except that it's "block level" (which sorta means it creates an automatic line break at the beginning and end to separate it from everything else), so you can use it when you want to use CSS to define the way a block-level element looks from scratch.

Skatefx
Bipolar (III) Inmate

From: Small Patch of Grass in CT
Insane since: Mar 2001

posted posted 02-28-2002 23:17

Im kind of wondering the same thing. I want to know how to use those. Can't you use them for an alternative to tables? Does anyone have links to some good tutes on this topic?


silence
Maniac (V) Inmate

From: soon to be "the land down under"
Insane since: Jan 2001

posted posted 03-01-2002 02:41

Thanks guys. Now the follow up question is: what's span?

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 03-01-2002 02:54

A span is the same thing as a Div except that it's inline instead of block-level. =)

Basically, a span tag is like a <b> or <i> or <font> tag, except that it doesn't *do* anything. It's completely void of effects. The text

hello <span>there</span> whats up

appears as

hello there whats up

the advantage to span is that you can use it to apply style sheets to a section of text that has no other way of describing its importance. For instance, if you think the word "cool" should always be blue, you can do

this is a <span class="myBlueColoredClass">cool</span> sentence.

So, yeah. That's what span does.

silence
Maniac (V) Inmate

From: soon to be "the land down under"
Insane since: Jan 2001

posted posted 03-01-2002 08:54

Ahh, I see.

So say I have three paragraphs that I want to be three different text colors with certain words in other colors. I could do it like this:

code:
<div class="blue">
blah <span class="red">blah</span> blah
</div>
<div class="green">
blah <span class="red">blah</span> blah
</div>
<div class="orange">
blah <span class="red">blah</span> blah
</div>



Now, I could do the same thing with the <p> tag so why would I use <div> over <p>?


Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 03-01-2002 16:05

<p> already has existing parameters (like margin) assigned to it. <div> does not.

« BackwardsOnwards »

Show Forum Drop Down Menu