homepage Welcome to WebmasterWorld Guest from 54.237.54.83
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderator: open

CSS Forum

    
UTf8 and validation error
toplisek




msg:4309215
 8:47 am on May 7, 2011 (gmt 0)

I have code on UTF8 pages like:
[PHP]
<ul>
<li>
<span>

<div style="margin: 10px 5px 0px;"></div><div style="border-style: dotted; border-width: 1px; padding: 2px 0px 2px 5px; background-color: rgb(225, 255, 230); margin-bottom: 3px;"><a href="index1.html">My index file</a></div><div style="margin:10px 5px 0px;"></div>

</span>

</li>
</ul>
[/PHP]

I can not modify this working code. Is there solution to fix this issue?

Error message:

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

 

robzilla




msg:4309222
 9:29 am on May 7, 2011 (gmt 0)

I'm confused. What does this particular HTML error have to do with the character-encoding of your page? And your question is, how can you make the page validate when you're unable to change the code?

The validator trips over the
DIV tags, which are block-level elements, that are placed within SPAN tags (an inline element). If you can't alter the code to take out those SPAN tags, you can't make this validate.

Also, if you can post the code here, how can it be that you cannot alter it? Or are you saying that you cannot alter the code without breaking the layout?

rocknbil




msg:4309953
 5:14 pm on May 9, 2011 (gmt 0)

You have two problems there, the block level divs are not valid inside the inline elements span *and* li.

The simplest solution (though it's still twisted up) is to change the inner divs to span and assign a display:block to them to emulate block displays. At least it will validate, but other problems may arise (block level elements inside inline elements = bound to be difficult.)

The cleanest solution would be to break all that down into li -> span -> a . . . but you claim you can't mod it so don't know what you'll do.

(Let me guess, Wordpress?)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved