GOO Posted November 25, 2006 Share Posted November 25, 2006 what is <div>?and i couldn't find where to learn it Link to comment Share on other sites More sharing options...
jlhaslip Posted November 25, 2006 Share Posted November 25, 2006 A <div> and </div> are used as start and end tags for a 'containing block' of html code. http://www.w3schools.com/tags/tag_div.asp Link to comment Share on other sites More sharing options...
GOO Posted November 25, 2006 Author Share Posted November 25, 2006 Somehow I find it weird when i use <div> and <span> to write these:<div> type:<html><body><p><div style="color:#ff0000;">Here it is!</div></p></body></html><span> type:<html><body><p><span style="color:#ff0000;">Here It is!</span></p></body></html>There is no difference!!!Why?What is the difference?Or what is the use of those? Link to comment Share on other sites More sharing options...
jlhaslip Posted November 25, 2006 Share Posted November 25, 2006 Div's, Paragraphs, and Spans are usually not utilizised the way you have them up there. Typically, a Div contains paragraphs and a paragraph will contain spans. If you were to learn a little more html or xhtml and read the specifications for the use of these tags, you would be aware of the difference between Block Level and Inline tags. Start by learning the difference between those terms. Link to comment Share on other sites More sharing options...
GOO Posted November 25, 2006 Author Share Posted November 25, 2006 Oh my god!What is block level?i've never heard of them.and also, although i always heard about inline, but what is inline? Link to comment Share on other sites More sharing options...
boen_robot Posted November 25, 2006 Share Posted November 25, 2006 The differences between a div, span and p are more semantical then visual. By semantic I mean their meaning... their purpose if you want. They are about "what" is the data in them, not "how it looks".A block to put it more simply means "bunch of stuff".A paragraph is a block of text. You've written essays in literature classes, haven't you? The introduction and thesis are written in one paragraph each.Visually, most browsers put a small margin around a paragraphs and put each on a new line.A "div" is used to define a "division". A devision may contain all sorts of things, but it's supposed to be a division of things, not simply a division of block of text, as with the paragraph. For example a div may contain several blocks of text (several paragraphs). If I go to the essay association again- you write each argument in it's own paragraph. The arguments together form a statement.Visually, browsers put each div on a new line.And "span" is used to mark text that may be found inside a line of a block of text (in a line=inline). This can be a word or prase or anything else.Visually, browsers don't do anything with a span, because span alone doesn't define the text in it to be anything special. Link to comment Share on other sites More sharing options...
GOO Posted November 26, 2006 Author Share Posted November 26, 2006 So, that means,if i wrote a <div>, it should contain <p>.And in the <p>, it should contain <span>, right?Like this:<html><head></head><body><div style="color:#488e5e"><p>Some text here. Some text here. Some text here.</p><p>Some text here. Some text here. Some text here.</p><p>Some text here. <span style="color:#2232ed">Some text here.</span> Some text here.</p></div></body></html> Link to comment Share on other sites More sharing options...
boen_robot Posted November 26, 2006 Share Posted November 26, 2006 Correct, but a <div> can contain all other sots of stuff as well. It may contain other divisions, one or more lists, one or more tables, etc.It's like a piece of the page you've decided to "cut" into it's own territory. Link to comment Share on other sites More sharing options...
GOO Posted November 30, 2006 Author Share Posted November 30, 2006 Ok!now i know!thanks Link to comment Share on other sites More sharing options...
sharleen Posted November 30, 2006 Share Posted November 30, 2006 Ok!now i know!thanksWhy didn't you just say a div is a layer, because thats all it is Link to comment Share on other sites More sharing options...
aspnetguy Posted November 30, 2006 Share Posted November 30, 2006 <div>'s are not layers. Any element can be made a layer with absolute postiioning or floating.a <div> is a division or "block" Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now