When should I use span and when should I use div??
span and div
Collapse
This topic is closed.
X
X
-
DMJTags: None
-
brucie
Re: span and div
in post <news:3ca0285f. 0312080139.3271 3e3@posting.goo gle.com>
DMJ said:
[color=blue]
> When should I use span and when should I use div??[/color]
--
brucie
08/December/2003 07:42:37 pm kilo
-
Bertrand Carlier
Re: span and div
brucie wrote:[color=blue]
> in post <news:3ca0285f. 0312080139.3271 3e3@posting.goo gle.com>
> DMJ said:
>
>[color=green]
>>When should I use span and when should I use div??[/color]
>
>
> http://www.w3.org/TR/html401/struct/....html#edef-DIV
>[/color]
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
Comment
-
Markus Ernst
Re: span and div
"DMJ" <derek.j@angus. ac.uk> schrieb im Newsbeitrag
news:3ca0285f.0 312080139.32713 e3@posting.goog le.com...[color=blue]
> When should I use span and when should I use div??[/color]
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
Comment
-
Alan J. Flavell
Re: span and div
On Mon, 8 Dec 2003, Bertrand Carlier wrote:
[color=blue]
> 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.[/color]
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.
Comment
-
Eric Bohlman
Re: span and div
"Alan J. Flavell" <flavell@ph.gla .ac.uk> wrote in
news:Pine.LNX.4 .53.03120810271 90.20620@ppepc5 6.ph.gla.ac.uk:
[color=blue]
> On Mon, 8 Dec 2003, Bertrand Carlier wrote:
>[color=green]
>> 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.[/color]
>
> 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.[/color]
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.
Comment
-
CJM
Re: span and div
"Alan J. Flavell" <flavell@ph.gla .ac.uk> wrote in message
news:Pine.LNX.4 .53.03120810271 90.20620@ppepc5 6.ph.gla.ac.uk. ..[color=blue]
> On Mon, 8 Dec 2003, Bertrand Carlier wrote:
>[color=green]
> > 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.[/color]
>
> 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.
>[/color]
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
Comment
-
Stan Brown
Re: span and div
>> in post <news:3ca0285f. 0312080139.3271 3e3@posting.goo gle.com>[color=blue][color=green]
>> DMJ said:[color=darkred]
>>>When should I use span and when should I use div??[/color][/color]
>brucie wrote:[color=green]
>> http://www.w3.org/TR/html401/struct/....html#edef-DIV[/color][/color]
In article <h0YAb.8726$uv1 .6119@nntpserve r.swip.net> in
comp.infosystem s.www.authoring.html, Bertrand Carlier
<teddybertrand@ yahoo.fr> wrote:[color=blue]
>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.[/color]
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
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/
Comment
-
Markus Ernst
Re: span and div
"Stan Brown" <the_stan_brown @fastmail.fm> schrieb im Newsbeitrag
news:MPG.1a3e60 c4ada8acb998b90 2@news.odyssey. net...[color=blue][color=green][color=darkred]
> >> in post <news:3ca0285f. 0312080139.3271 3e3@posting.goo gle.com>
> >> DMJ said:
> >>>When should I use span and when should I use div??[/color]
> >brucie wrote:[color=darkred]
> >> http://www.w3.org/TR/html401/struct/....html#edef-DIV[/color][/color]
>
> In article <h0YAb.8726$uv1 .6119@nntpserve r.swip.net> in
> comp.infosystem s.www.authoring.html, Bertrand Carlier
> <teddybertrand@ yahoo.fr> wrote:[color=green]
> >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.[/color]
>
> 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.
>[/color]
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
Comment
-
True Gamer
Re: span and div
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:
[color=blue]
> When should I use span and when should I use div??[/color]
Comment
-
Stan Brown
Re: span and div
In article <3fd49e55$0$388 $afc38c87@news. easynet.ch> in
comp.infosystem s.www.authoring.html, Markus Ernst
<derernst@NO#SP #AMgmx.ch> wrote:[color=blue]
>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.[/color]
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
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/
Comment
-
Mad Bad Rabbit
Re: span and div
"Alan J. Flavell" <flavell@ph.gla .ac.uk> wrote:
[color=blue]
> 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.[/color]
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...)
[color=blue]
>;K[/color]
Comment
-
Stan Brown
Re: span and div
In article <H_SdnRMjztXts0 iiRTvUqQ@texas. net> in
comp.infosystem s.www.authoring.html, Mad Bad Rabbit
<madbadrabbit@y ahoo.com> wrote:[color=blue]
>"Alan J. Flavell" <flavell@ph.gla .ac.uk> wrote:
>[color=green]
>> 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.[/color]
>
>The W3 spec isn't really a suitable answer for a novice, though.[/color]
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
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/
Comment
-
Anders Wegge Jakobsen
Re: span and div
"Bertrand" == Bertrand Carlier <teddybertrand_ nospam@yahoo.fr > writes:
[color=blue]
> 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[/color]
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.bakkely gaard.dk/~wegge/>
echo mail: !#^."<>"|tr "<> mail:" dk@wegge
Comment
-
Bertrand Carlier
Re: span and div
Anders Wegge Jakobsen a écrit :[color=blue]
> "Bertrand" == Bertrand Carlier <teddybertrand_ nospam@yahoo.fr > writes:
>
>[color=green]
>>so i use them as follows : div is for structuring conceptually
>>different information (menu vs content vs addons...) span is for
>>highlightin g some text among some other text or for separating
>>differents parts of information that cannot really be considered as
>>lists[/color]
>
>
> 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.
>[/color]
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
Comment
Comment