Current location: Hot Scripts Forums » General Web Coding » HTML/XHTML/XML » Using multiple Span Classes for one Object ?


Using multiple Span Classes for one Object ?

Reply
  #1 (permalink)  
Old 03-08-10, 09:03 PM
lucidfox lucidfox is offline
New Member
 
Join Date: Jan 2010
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Arrow Using multiple Span Classes for one Object ?

Hey all,

I'm running into a problem with some code on a page I'm creating. Here it is... (the <span class="class1"> is the new addition causing the problems) ...

HTML Code:
<span class="class1"><div class="Object166"><table border=0 cellspacing=0 cellpadding=0><tr><td valign="top" align="left"><div class="text-align:left;margin-left:0px;text-indent:0px;"><span class="textstyle1"><a href="#">Home</a><br>
</span></div></td></tr></table></div></span>
Basically it does what I want it to do but it does not pass validation (W3C). I recently added the class1 code because I need the link colors to vary from the rest of the page. To break it down...

The textstyle1 is defining my font, size, etc. and my class1 is defining the link attributes. I know it's suppose to be written differently but I can't figure out how to add multiple span classes to a single object and have it pass validation.

I need to do this to multiple objects throughout the page.

Any help would be great.
Reply With Quote
  #2 (permalink)  
Old 03-09-10, 02:29 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
It looks like this is a piece of page navigation.

HTML Code:
<span class="class1">
<div class="Object166">
<table border=0 cellspacing=0 cellpadding=0>
<tr>
<td valign="top" align="left">
<div class="text-align:left;margin-left:0px;text-indent:0px;">
<span class="textstyle1"><a href="#">Home</a>
<br>
</span>
</div>
</td>
</tr>
</table>
</div>
</span>
You might want to take a bit more time with the XHTML and style it so there are fewer tags, and more of the layout and design are in the CSS. The code below is just a sample, and I haven't tested it - but it might be easier to work with.

HTML Code:
<style type="text/css">
.navigation
{
color:#008;
background-color:#100;
}
.navigation ul
{
list-style:none;
}
.navigation ul li a
{
color:#fff;
}
.navigation ul li a:hover
{
color:#000;
}
</style>
<body>
<div class="navigation">
<ul>
<li>
<a href="#">Home</a>
</li>
<li>
<a href="next.htm">Next</a>
</li>
</ul>
</div> ...
Please post more code next time, it makes it easier to help you.
Reply With Quote
  #3 (permalink)  
Old 03-09-10, 02:52 PM
lucidfox lucidfox is offline
New Member
 
Join Date: Jan 2010
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Sorry about the lack of code. You can view the webpage here. If you validate the page on W3C you'll see it is failing specifically with the newly added span tags I mentioned above. Here is the error that W3C is giving...

Quote:
document type does not allow element "DIV" here; missing one of "APPLET", "OBJECT", "MAP", "IFRAME", "BUTTON" start-tag
Thank you for the help
Reply With Quote
  #4 (permalink)  
Old 03-09-10, 02:57 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
I think you need to change the navigation code, it's awkward. Validating it won't make it better.
Reply With Quote
  #5 (permalink)  
Old 03-15-10, 08:51 AM
CodeRobber's Avatar
CodeRobber CodeRobber is offline
Newbie Coder
 
Join Date: Feb 2010
Location: Leicestershire UK
Posts: 19
Thanks: 0
Thanked 2 Times in 2 Posts
I would personally get rid of that span element - its a block element so its basically the same as putting div's inside a <p> tag.

Just change it to another div and style it accordingly I think.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a browser RPG in javascript SolidSamurai JavaScript 26 10-20-08 03:27 PM
getting the actual widht and height of a span davidklonski JavaScript 0 06-29-04 11:47 AM
Object Oriented Programming Stefan PHP 29 12-30-03 11:22 AM


All times are GMT -5. The time now is 09:12 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.