<SPAN>s! Why do we need Spans?
Moderator: General Moderators
<SPAN>s! Why do we need Spans?
Why do we need <spans>? What're the really useful and practicall implementations of spans?
How would you do this using CSS?
Hello World, my name is James
Hello World, my name is James
Code: Select all
.divex{
color:red;
}
.divexname{
color: green;
}
<div id="mytitle" class="divex">Hello World, my name is <span class="divexname">James</span></div>- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
In old HTML everything was a mix between structure information and presentation. Using CSS we are trying to break this apart. You have your structure produced possibly through PHP and you have you presentation information based, hopefully on CSS. To make this clearer the <font> tag was deprecated (should no longer be used) after all "font" implies text formatting when css can be far more.
<DIV> is used as a block element.
<SPAN> is used as an inline element.
You must bear in mind that different formats (print, web, speech) may each use a different style sheet. If using speech you would not use a "font". Using this approach <b>,<strong> and <i> tags should also never be used. <span class="important"> or <span class="indexed"> means that things are far more flexible if you need to produce different presentation methodologies.
<DIV> is used as a block element.
<SPAN> is used as an inline element.
You must bear in mind that different formats (print, web, speech) may each use a different style sheet. If using speech you would not use a "font". Using this approach <b>,<strong> and <i> tags should also never be used. <span class="important"> or <span class="indexed"> means that things are far more flexible if you need to produce different presentation methodologies.
Last edited by CoderGoblin on Thu Sep 15, 2005 9:15 am, edited 1 time in total.