SnippetMaster Support Forums
Return to main website
 
August 29, 2009, 01:02:36 AM
* Show unread posts since last visit.
* Show new replies to your posts.
Welcome, Guest. Please login or register.
Did you miss your activation email?
August 29, 2009, 01:02:36 AM

Login with username, password and session length
Search:  
Advanced search
* Home Help Search Login Register
SnippetMaster Support Forums  |  General  |  General Discussion & Support  |  Topic: Getting contextual / descendant selectors to style within snippets « previous next »
Pages: [1] Print
Author Topic: Getting contextual / descendant selectors to style within snippets  (Read 35 times)
beano

Posts: 1


[-] Getting contextual / descendant selectors to style within snippets
« on: August 19, 2009, 03:24:15 AM »

Good css obviously has liberal use of contextual / descendant selectors eg:

#HomePage p {
        padding: 20px;
   font-size: 1.5em;
}
#HomePage ul.thumb {
   float: left;
   list-style: none;
}


When editing a snippet, if the snippet contains all the contextual / descendant selectors required for styling, all is OK, and the wysiwyg editor will style its content correctly eg:

<!-- #BeginSnippet name="Content" -->
<div id="HomePage">
  <p>Bla text...</p>
<ul class="thumb">
  <li>Item1</li>
  <li>Item2</li>
</ul>
</div>
<!-- #EndSnippet -->


BUT it is ALL TOO EASY for a user to accidentally delete the DIV (eg CRTL+A and Delete), and now your snippet will not style correctly when they reenter text - ie PAGE BROKEN, and a NASTY thing for a webmaster diagnose and to go and fix.

SO, we might try changing the HTML to be thus:

<div id="HomePage">
<!-- #BeginSnippet name="Content" -->
  <p>Bla text...</p>
<ul class="thumb">
  <li>Item1</li>
  <li>Item2</li>
</ul>
<!-- #EndSnippet -->
</div>



HOWEVER, now the wysiwyg editor won't pick up the contextual / descendant selectors, and thus the wysiwyg editing NOT ACCEPTABLE from a users perspective.


Is there an answer to this conundrum?
- obviously I could create specific homepage styles for each tag eg ul.thumb-homepage, BUT this is very bad css form.

(nb Having noticed that each snippet within the editor is in fact its own IFRAME with the surrounding HTML of your page stripped out, I can totally see why the wysiwyg editor does not style contextual / descendant selectors correctly.)

« Last Edit: August 19, 2009, 02:13:29 PM by beano » Report to moderator   Logged
Pages: [1] Print 
SnippetMaster Support Forums  |  General  |  General Discussion & Support  |  Topic: Getting contextual / descendant selectors to style within snippets « previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!