DIV with no content in it.

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
Esteban_Granero
New Member
New Member
Posts: 7
Joined: Mon Apr 12, 2010 2:26 pm

DIV with no content in it.

Post 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?!
foox
Forum Members
Forum Members
Posts: 14
Joined: Tue Apr 13, 2010 9:19 am

Re: DIV with no content in it.

Post by foox »

Hi, you have to set height for the div id declaration, for example "height:1px".
Esteban_Granero
New Member
New Member
Posts: 7
Joined: Mon Apr 12, 2010 2:26 pm

Re: DIV with no content in it.

Post 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;
}
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: DIV with no content in it.

Post 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.
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
vilkis

Re: DIV with no content in it.

Post 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
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: DIV with no content in it.

Post 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.
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: DIV with no content in it.

Post by Dr.CSS »

Adding   may stop it from eating an empty div...
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: DIV with no content in it.

Post 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.
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
owr_bgld

Re: DIV with no content in it.

Post 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
KO
Power Poster
Power Poster
Posts: 562
Joined: Mon Nov 06, 2006 7:55 pm
Location: Helsinki, Finland

Re: DIV with no content in it.

Post 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.
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: DIV with no content in it.

Post 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.
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
Esteban_Granero
New Member
New Member
Posts: 7
Joined: Mon Apr 12, 2010 2:26 pm

Re: DIV with no content in it.

Post by Esteban_Granero »

Thanks!

It worked with the transparent 1px png!

Gratitude.
Post Reply

Return to “Layout and Design (CSS & HTML)”