Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read Web Directory

Go Back   Webmaster Forum > Designing and Developing Websites > Web Design

Web Design Discussions and help on Website Design, HTML, CSS, xHTML, DHTML, etc...

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 01-15-2008, 11:29 PM
untikoplus untikoplus is offline
WMG Newcomer
 
Join Date: Jan 2008
Posts: 30
iTrader: (0)
untikoplus is on a distinguished road
Default <span> </span> tags?

What are <span> </span> tags for?

When using html editors, part of the "extra" code they add are usually these <span> </span> tags that I have no idea what they are for, since when I delete them from the page, nothing changes.

Any idea?
Reply With Quote
Sponsored Links
Register and sign in to hide this ad block

  #2 (permalink)  
Old 01-16-2008, 03:44 AM
alexd181 alexd181 is offline
WMG Resident Alien
 
Join Date: Jan 2008
Posts: 104
iTrader: (0)
alexd181 is on a distinguished road
Default

<div> tags cause a line to break but <span> tags do not.

For example, if I write <div style="color:red">Red text</div> it will output that on a new line.

However say I want to have a line of black text but only one word in red I'd use sentence...... <span style="color:red">Red text</span> ......sentence.
Reply With Quote
  #3 (permalink)  
Old 01-16-2008, 07:44 AM
creek23 creek23 is offline
WMG Deputy Sheriff
 
Join Date: Mar 2007
Posts: 290
iTrader: (0)
creek23 is on a distinguished road
Default

span applies a style on a "span" of text. div on the other hand, applies it too but adds a "newline" at the last selected text.
Reply With Quote
  #4 (permalink)  
Old 01-17-2008, 01:28 AM
chrishirst's Avatar
chrishirst chrishirst is offline
WMG Sheriff
 
Join Date: Nov 2007
Posts: 170
iTrader: (0)
chrishirst is on a distinguished road
Default

The technical answer is;

A <div> is a BLOCK level element and is used to define distinct parts of a document and structural divisions.
Block elements have an implied line break before and after.

A <span> is an INLINE element and these are used as presentation elements only.
__________________
And how can we win, when fools can be kings
Reply With Quote
  #5 (permalink)  
Old 01-17-2008, 02:05 PM
agilius agilius is offline
WMG Newcomer
 
Join Date: Jan 2008
Posts: 43
iTrader: (0)
agilius is on a distinguished road
Default

spans is a simpler div for me. It's easy to change the div and make it act like a span via CSS but sometimes it's easier to add span tags.

The most common use of span tags for me is when I add "read more" button on an article that I write and publish on some of my blogs. Blogger requires that users mark the mask content with span tags.
Reply With Quote
  #6 (permalink)  
Old 01-22-2008, 03:23 AM
untikoplus untikoplus is offline
WMG Newcomer
 
Join Date: Jan 2008
Posts: 30
iTrader: (0)
untikoplus is on a distinguished road
Default

Wow, thanks for your explanations.
I had some articles to code in html and this <span> tag has helped me a lot, saving many codes.
It's really useful once you learn what it is for.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

All times are GMT. The time now is 08:17 PM.



Freelance Web Designers
Work At Home Forum
Ad Marketplace
Online Deals and Bargains
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0