Jump to content
xisto Community
Sign in to follow this  
Saint_Michael

<div> Tag Info some useful info on using the div tag

Recommended Posts

from my understanding of how the <div> tag works its always a good idea to use tables to get an idea where you want to you text to be position at. Also it is possibl to use negetive numbers to help position your table but that is use most of the time with the ABSOLUTE POSITION


-div style=left, right, center: basically this tells you where you info will be positioned on your website

-width: this tells how wide you can make your table so to speak where text wrapping begins

-height: this tells you how long the vertical postion will be and how far down you can go on your website with infomation

-absolute: top, bottom, : this tells you where you would like to position your area of infomation on your website it is

<div style="left: 0px; width: 0px; position: absolute; top: 0px; height: 0px"><div style="right: 0px; width: 0px; position: absolute; top: 0px; height: 0px"><div style="center: 0px; width: 0 px; position: absolute; top: 0 px; height: 0px">

when using mutiple div tags you want to close it each time EXAMPLE:
<div style="left: 0px; width: 0px; position: absolute; top: 0px; height: 0px"></div><div style="right: 0px; width: 0px; position: absolute; top: 0px; height: 0px"></div><div style="center: 0px; width: 0 px; position: absolute; top: 0 px; height: 0px"></div>

and then when you want to completly close it just put a </div> at the end of the document like this

</div></body</html>

if i missed anything left me know

Share this post


Link to post
Share on other sites

Looks good :) . The div tag can be used for most anything, the span tag acts alot like it.

Share this post


Link to post
Share on other sites

Looks good  :) . The div tag can be used for most anything, the span tag acts alot like it.

69105[/snapback]


Can you please tell what is the difference between div and span tag. Although I have used them both but I could not find a clear difference between them.

Share this post


Link to post
Share on other sites

Can you please tell what is the difference between div and span tag. Although I have used them both but I could not find a clear difference between them.

69216[/snapback]


The <span> tag is very similar to the <div> tag, and the major difference between the <span> and <div> tags is that <span> will not do any formatting of it's own.

 

The <div> tag acts as a paragraph break, because it is defining a logical division in the document. It is comparable to the <p>tag, but advanced in that css style can also be applied individually to each <div> tag. Browsers usually place a line break before and after the <div> element.

 

The <span> tag simply tells the browser to apply style and align to contents between <span></span>.

 

Attributes:

[B]<div>Standard attributes[/B]id, class, title, style, dir, lang, xml:lang (align attribute has become obsolete now)[B]<div>Event attributes[/B]onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup[B]<span>Standard attributes[/B]id, class, title, style, align, dir, lang, xml:lang

Look at this code:

<DIV id="member-data" class="member"><P><SPAN class="member-title">Member information:</SPAN><TABLE class="member-data"><TR><TH>Last name:<TD>Glue</TR><TR><TH>First name:<TD>Goo</TR><TR><TH>Tel:<TD>(000) 111-2222</TR><TR><TH>Email:<TD>googlue@gmail.org</TR></TABLE></DIV><DIV id="member-data" class="member"><P><SPAN class="member-title">Member information:</SPAN><TABLE class="member-data"><TR><TH>Last name:<TD>Lanky</TR><TR><TH>First name:<TD>So</TR><TR><TH>Tel:<TD>(000) 111-3333</TR><TR><TH>Email:<TD>solanky@gmail.org</TR></TABLE></DIV>

This is all I know about <div> and <span>. I also use <table> tag frequently, and am more comfortable doing so than using <div> and <span> tags.

 

But <div> and <span> are what's hot now!

 

Good luck!

Googlue

Share this post


Link to post
Share on other sites

Thanks googlue for your kind reply. Now the difference between div and span tag is more clear for me. I will try to further explore this difference when I will use them in my code.Thanks.

Share this post


Link to post
Share on other sites

yeah i should have formatted it with tables hmm and i completly forgot about the span well never really used it myself :o

Share this post


Link to post
Share on other sites

the <span> tag is an inline element and is meant to be used to format text without tags like <font><b><i>, etc... in the newest versions of html, these tags are depreciated. and <span> can be used to define all of them.the <div> tag is meant more as an item rather than just text formating.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.