Page 1 of 1

DIV with no content in it.

Posted: Tue Apr 13, 2010 9:01 am
by Esteban_Granero
Hi,

I'm new to CMS and this is probably a noob question.

I'm placing a DIV in my page with no content in it:




(this is a 1pixel line with repeat-x).

It does not show anything in my browser.
When I use:

xxx


It shows the line properly but with the XXX in it. (wich I dont want).

Does anybody know why this CMS can't show a div with no content?!

Re: DIV with no content in it.

Posted: Tue Apr 13, 2010 9:23 am
by foox
Hi, you have to set height for the div id declaration, for example "height:1px".

Re: DIV with no content in it.

Posted: Tue Apr 13, 2010 11:16 am
by Esteban_Granero
foox wrote: Hi, you have to set height for the div id declaration, for example "height:1px".
This is the CSS for the #line div:

#line {
background-image:url(images/line.png);
background-repeat:repeat-x;
width:400px;
height:6px;
margin:20px 0;
}

Re: DIV with no content in it.

Posted: Tue Apr 13, 2010 3:26 pm
by tyman00
This isn't a CMS issue, it's a CSS/XHTML/Browser issue. Make sure you validate your page and if that doesn't work feel free to check out other forums that may be able to help you.

Re: DIV with no content in it.

Posted: Tue Apr 13, 2010 3:43 pm
by vilkis
Hi
TinyMCE clears empty divs. I do not know how to turn off this feature. If I need to add the empty div to content I use an image of one transparent pixel:

Code: Select all

<div class="clear"><img src="images/sep.gif" alt="" width="1" height="1" /></div>
vilkis

Re: DIV with no content in it.

Posted: Tue Apr 13, 2010 4:08 pm
by tyman00
Good catch Vilkis, I never thought of that possibility.

I know why Tiny does it (to clean up rogue code from inexperienced editors), but it sure is annoying for developers like us.

Re: DIV with no content in it.

Posted: Tue Apr 13, 2010 4:09 pm
by Dr.CSS
Adding   may stop it from eating an empty div...

Re: DIV with no content in it.

Posted: Tue Apr 13, 2010 4:16 pm
by tyman00
I am posting this option under the assumption that everyone knows we cannot and will not support hacked installations.

Because of editors copy/pasting content, I don't think we will want to make this default in CMSMS.

Looks like we need to edit the extended_valid_elements call.

http://wiki.moxiecode.com/index.php/Tin ... d_elements

So it looks something like:  extended_valid_elements : "div[align<center?justify?left?right|class|id|style]" 

This isn't 100% correct for this setup and I haven't read the documentation through. But it's a good starting point for someone.

Re: DIV with no content in it.

Posted: Tue Apr 13, 2010 6:45 pm
by owr_bgld
Dr.CSS wrote: Adding   may stop it from eating an empty div...
yeah - but only till first eding of the page - " " is getting " " in tyni - and " " is like nothing and the next time the div is gone

Re: DIV with no content in it.

Posted: Tue Apr 13, 2010 6:51 pm
by KO
That works. You can paste it in TinyMCE -> Advanced -> Extra configuration .. I don't see how that would make CMSMS itself hacked.

Good tip Tyman!

Esteban: One way to do it is to style "hr" tag as wanted as it would be easily added with editor. You can add that "hr" to toolbar by putting hr separated with comma like others.

Re: DIV with no content in it.

Posted: Tue Apr 13, 2010 6:59 pm
by tyman00
KO wrote: That works. You can paste it in TinyMCE -> Advanced -> Extra configuration .. I don't see how that would make CMSMS itself hacked.
You are right! I should have payed more attention to that tab. I was thinking one would have to modify the config file in the TinyMCE module folder.

Re: DIV with no content in it.

Posted: Wed Apr 14, 2010 8:24 am
by Esteban_Granero
Thanks!

It worked with the transparent 1px png!

Gratitude.