By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,622 Members | 1,154 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,622 IT Pros & Developers. It's quick & easy.

span and div

P: n/a
DMJ
When should I use span and when should I use div??
Jul 20 '05 #1
Share this Question
Share on Google+
20 Replies


P: n/a
in post <news:3c*************************@posting.google.c om>
DMJ said:
When should I use span and when should I use div??


http://www.w3.org/TR/html401/struct/....html#edef-DIV

--
brucie
08/December/2003 07:42:37 pm kilo
Jul 20 '05 #2

P: n/a
brucie wrote:
in post <news:3c*************************@posting.google.c om>
DMJ said:

When should I use span and when should I use div??

http://www.w3.org/TR/html401/struct/....html#edef-DIV

wow...
"don't bother me, just go and see the w3c"

i'm just feeling that this is not the purpose of a newsgroup to just
send people away when they have so-called "trivial" questions.
And for the span/div question i've not seen a really clear tutorial
where it is explained and i had to figure out by myself what they were
used for and what was their interest.

so i use them as follows :
div is for structuring conceptually different information (menu vs
content vs addons...)
span is for highlighting some text among some other text or for
separating differents parts of information that cannot really be
considered as lists

of course there are a lot of way to implement span & div and it's up to
you to find the right way, having in mind the question "does i really
need a span/div here? what does it mean in my structure?"

hope this helps
Jul 20 '05 #3

P: n/a
"DMJ" <de*****@angus.ac.uk> schrieb im Newsbeitrag
news:3c*************************@posting.google.co m...
When should I use span and when should I use div??


Span is an inline element, which means that it makes part of a flow of
elements, usually text, that are wrapped at the end of the line.

Div is a block element, it is supposed to be used as a container for the
flow of elements or text.

Some people use div as a replacement for the p tag and other text elements
(like <div class="title">). I personally think it is the cleanest way to use
content-related elements the way they are meant:

p for text paragraphs
h1, h2... for headlines
ul/ol, li for lists
table, td, tr for tables

- put them into divs to define the macro structure
- use spans inside of them for inline formatting

HTH
Markus
Jul 20 '05 #4

P: n/a
On Mon, 8 Dec 2003, Bertrand Carlier wrote:
i'm just feeling that this is not the purpose of a newsgroup to just
send people away when they have so-called "trivial" questions.


If their question shows that they've already consulted the spec or
other relevant resource, and some part of it gave rise to a question,
then this would be a good place to discuss the issue.

If their question shows no sign that they've found the spec, then I'd
have thought referring them to the spec was the first step in any
further discussion. If you think that's "sending them away", then you
appear to have have a very thin skin, and may not be able to get much
benefit from the rough and tumble of a typical usenet thread.

Jul 20 '05 #5

P: n/a
"Alan J. Flavell" <fl*****@ph.gla.ac.uk> wrote in
news:Pi*******************************@ppepc56.ph. gla.ac.uk:
On Mon, 8 Dec 2003, Bertrand Carlier wrote:
i'm just feeling that this is not the purpose of a newsgroup to just
send people away when they have so-called "trivial" questions.


If their question shows that they've already consulted the spec or
other relevant resource, and some part of it gave rise to a question,
then this would be a good place to discuss the issue.

If their question shows no sign that they've found the spec, then I'd
have thought referring them to the spec was the first step in any
further discussion. If you think that's "sending them away", then you
appear to have have a very thin skin, and may not be able to get much
benefit from the rough and tumble of a typical usenet thread.


To amplify a bit, when someone asks a question in a technical group and
that question is one that can be answered by an authoritative source like a
W3C Recommendation or an RFC, referring that person to the authoritative
source is really *more* helpful than trying to come up with one's own
answer. Even the best of us sometimes screw up when we try to answer
questions, and it's silly to risk that when you know there's an answer out
on the Net that's guaranteed *not* to screw up.

Remember that if someone is a newbie to a particular technology, they don't
know enough about it to be able to properly evaluate the accuracy of the
advice they get in a newsgroup. Until someone gains a good deal of
familiarity with, say, HTML, they'd do well to get their advice straight
from the horse's mouth. Otherwise, they run the risk of getting their
advice from someone who's barely learned the subject or from someone who
was simply having a bad day. That won't happen when you go to an
authoritative source; the authors of the HTML Recommendation can be assumed
to understand HTML better than anyone else, and the document itself never
gets tired or preoccupied.
Jul 20 '05 #6

P: n/a
CJM

"Alan J. Flavell" <fl*****@ph.gla.ac.uk> wrote in message
news:Pi*******************************@ppepc56.ph. gla.ac.uk...
On Mon, 8 Dec 2003, Bertrand Carlier wrote:
i'm just feeling that this is not the purpose of a newsgroup to just
send people away when they have so-called "trivial" questions.


If their question shows that they've already consulted the spec or
other relevant resource, and some part of it gave rise to a question,
then this would be a good place to discuss the issue.

If their question shows no sign that they've found the spec, then I'd
have thought referring them to the spec was the first step in any
further discussion. If you think that's "sending them away", then you
appear to have have a very thin skin, and may not be able to get much
benefit from the rough and tumble of a typical usenet thread.


Although it is reasonable to enlighten people to the existence of the W3C
specs,
I don't thin that should be the stock answer. The specs can be intimidating,
especially
for novices. It's like the difference between a 'reference' and a 'guide' -
the former you refer to get a detailed technical explanation of a subject,
the latter helps teaches you about a subject.. more a How-To guide.

And I dont think thick should be a prerequisite for NG participation.

However, DMJ asked about these two tags a week ago (01/12/2003). If the
answers given weren't enough, IMHO he should have asked for further help in
that thread, rather than start a new thread.

Getting back on to the subject... I think Markus' post sums it up nicely....

Chris

Jul 20 '05 #7

P: n/a
>> in post <news:3c*************************@posting.google.c om>
DMJ said:
When should I use span and when should I use div??
brucie wrote:
http://www.w3.org/TR/html401/struct/....html#edef-DIV


In article <h0*****************@nntpserver.swip.net> in
comp.infosystems.www.authoring.html, Bertrand Carlier
<te***********@yahoo.fr> wrote:wow...
"don't bother me, just go and see the w3c"

i'm just feeling that this is not the purpose of a newsgroup to just
send people away when they have so-called "trivial" questions.


Maybe not the first fifty times the same "trivial" question is
posted.

After that -- well, you're welcome to waste _your_ time writing a
custom answer to the same trivial question.

This particular trivial question was asked and answered within the
last day or two.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #8

P: n/a
"Stan Brown" <th************@fastmail.fm> schrieb im Newsbeitrag
news:MP************************@news.odyssey.net.. .
in post <news:3c*************************@posting.google.c om>
DMJ said:
When should I use span and when should I use div??

brucie wrote:
http://www.w3.org/TR/html401/struct/....html#edef-DIV


In article <h0*****************@nntpserver.swip.net> in
comp.infosystems.www.authoring.html, Bertrand Carlier
<te***********@yahoo.fr> wrote:
wow...
"don't bother me, just go and see the w3c"

i'm just feeling that this is not the purpose of a newsgroup to just
send people away when they have so-called "trivial" questions.


Maybe not the first fifty times the same "trivial" question is
posted.

After that -- well, you're welcome to waste _your_ time writing a
custom answer to the same trivial question.


Well at least asking this trivial question shows that the OP cares about
writing good code. It is not a stupid question IMO.

There are other questions in this kind of groups that express that the OP is
too lazy to move his a** and wants to have his job done for free instead of
learning himself. There are stupid questions undoubtedly. This original
posting did not sound like that to me.

It is of course up to you what questions you want to waste your time on. But
sometimes it is surprising how people who don't want to waste their time for
an answer waste it for telling the OP that he is stupid.

--
Markus
Jul 20 '05 #9

P: n/a
Span and Div are elements used for style sheets. You use div before a
paragraph or heading and span inside of 1. With div, you can also
define the alignment which was all it was used for in HTML 3.2.
---------------------------------------------------------------------------
DMJ wrote:
When should I use span and when should I use div??


Jul 20 '05 #10

P: n/a
In article <3f*********************@news.easynet.ch> in
comp.infosystems.www.authoring.html, Markus Ernst
<derernst@NO#SP#AMgmx.ch> wrote:
There are other questions in this kind of groups that express that the OP is
too lazy to move his a** and wants to have his job done for free instead of
learning himself. There are stupid questions undoubtedly. This original
posting did not sound like that to me.


As I pointed out, the same question has already been asked and
answered recently.

As someone else pointed out, it was asked by the same person!

We've been trolled, folks.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #11

P: n/a
"Alan J. Flavell" <fl*****@ph.gla.ac.uk> wrote:
If their question shows no sign that they've found the spec, then I'd
have thought referring them to the spec was the first step in any
further discussion. If you think that's "sending them away", then you
appear to have have a very thin skin, and may not be able to get much
benefit from the rough and tumble of a typical usenet thread.
The W3 spec isn't really a suitable answer for a novice, though.
It'd probably be more appropriate to send them to htmlhelp.com
or some similar reference aimed at less technical users.

(that said, they have no right to complain, since they're not
paying anything for whatever assistance they may get here...)

;K

Jul 20 '05 #12

P: n/a
In article <H_********************@texas.net> in
comp.infosystems.www.authoring.html, Mad Bad Rabbit
<ma**********@yahoo.com> wrote:
"Alan J. Flavell" <fl*****@ph.gla.ac.uk> wrote:
If their question shows no sign that they've found the spec, then I'd
have thought referring them to the spec was the first step in any
further discussion. If you think that's "sending them away", then you
appear to have have a very thin skin, and may not be able to get much
benefit from the rough and tumble of a typical usenet thread.


The W3 spec isn't really a suitable answer for a novice, though.


Oh please. Brucie (or was it Brian?) gave the specific section that
was relevant. At some point we have to stop coddling feckless
laziness and demand that people put forth a modicum of effort to
master these things -- particularly people who post the SAME DAMN
QUESTION days after it they posted it and got answers.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #13

P: n/a
"Bertrand" == Bertrand Carlier <te******************@yahoo.fr> writes:
so i use them as follows : div is for structuring conceptually
different information (menu vs content vs addons...) span is for
highlighting some text among some other text or for separating
differents parts of information that cannot really be considered as
lists


Thats probably a rather good explanation of the *uses* of span and
div, but to get the full picture, it is important to remember the
rendering differences of the two.

The <span> element is an inline element, so it will (or should be)
rendered in the normal flow of text in the page. On the other hand,
the <div> element is a block level element, so it will break the text
flow of the page, and be vertically positioned by itself, unless of
course float or other positioning is specified.

--
/Wegge <http://outside.bakkelygaard.dk/~wegge/>
echo mail: !#^."<>"|tr "<> mail:" dk@wegge
Jul 20 '05 #14

P: n/a
Anders Wegge Jakobsen a écrit :
"Bertrand" == Bertrand Carlier <te******************@yahoo.fr> writes:

so i use them as follows : div is for structuring conceptually
different information (menu vs content vs addons...) span is for
highlighting some text among some other text or for separating
differents parts of information that cannot really be considered as
lists

Thats probably a rather good explanation of the *uses* of span and
div, but to get the full picture, it is important to remember the
rendering differences of the two.

The <span> element is an inline element, so it will (or should be)
rendered in the normal flow of text in the page. On the other hand,
the <div> element is a block level element, so it will break the text
flow of the page, and be vertically positioned by itself, unless of
course float or other positioning is specified.

true, so true that i didn't think of it though i'm often fighting with
those blocks or inline element in the html flow still trying to
understand in what order i should put them to rendre what i have in mind
Jul 20 '05 #15

P: n/a
DMJ
I asked twice cos I didn't get a proper answer the first time.

I had been to the standards.

I ask concise questions to save my time typing them and yours reading
them.

If you think this is rough and tumble, you have led a sheltered life.

Any of you assholes seen the sunshine lately?

While you have been arguing over and assuming what has been going
through my head over the past 4 days, I have been having sex, drinking
beer and laughing a lot.

Assholes!
Jul 20 '05 #16

P: n/a
DMJ wrote:

If you think this is rough and tumble, you have led a sheltered life.

Any of you assholes seen the sunshine lately?

While you have been arguing over and assuming what has been going
through my head over the past 4 days, I have been having sex, drinking
beer and laughing a lot.

Assholes!


Charming fellow. <plonk>

--
Brian
follow the directions in my address to email me

Jul 20 '05 #17

P: n/a
DMJ wrote:
I asked twice cos I didn't get a proper answer the first time.
to what?
I have been having sex, drinking beer and laughing a lot.


neat trick. URL?

--
William Tasso - http://WilliamTasso.com
Jul 20 '05 #18

P: n/a

"DMJ" <de*****@angus.ac.uk> wrote in message
news:3c**************************@posting.google.c om...
I asked twice cos I didn't get a proper answer the first time.


I know I answered you twice. No comment on that. Buh-bye.
Jul 20 '05 #19

P: n/a
de*****@angus.ac.uk (DMJ) wrote in
news:3c**************************@posting.google.c om:
While you have been arguing over and assuming what has been
going through my head over the past 4 days, I have been having
sex, drinking beer and laughing a lot.


I answered you the first time; you are welcome to do what you wish in
your own time, but regulars in this group took time out to help you
out.

Please remember that.

--
Kayode Okeyode
http://www.kayodeok.co.uk/weblog/
http://www.kayodeok.btinternet.co.uk.../webdesign.htm
Jul 20 '05 #20

P: n/a
"DMJ" <de*****@angus.ac.uk> schrieb im Newsbeitrag
news:3c**************************@posting.google.c om...
I asked twice cos I didn't get a proper answer the first time.

I had been to the standards.

I ask concise questions to save my time typing them and yours reading
them.

If you think this is rough and tumble, you have led a sheltered life.

Any of you assholes seen the sunshine lately?

While you have been arguing over and assuming what has been going
through my head over the past 4 days, I have been having sex, drinking
beer and laughing a lot.

Assholes!


If you want to get help you have to accept that every aspect of your
question is discussed. Go on drinking and welcome to my killfile.
Jul 20 '05 #21

This discussion thread is closed

Replies have been disabled for this discussion.