[SOLVED] Background opacity, everything on top 100% normal

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
Evert B.
Power Poster
Power Poster
Posts: 414
Joined: Fri Oct 20, 2006 12:07 pm

[SOLVED] Background opacity, everything on top 100% normal

Post by Evert B. »

Hello,

I am busy trying to make a site for me and my fishing mates. I want it to have a background image and on top of that a wrapper with 60% opacity so that the background is still visible. However, the content should be normal, not opacity. After long searching and trying I managed this, but now I cannot ensure that if I have lots of content (a long page) the opacity still works below 100% of my screen size. The following link will explain what I mean.
Preferibly I want the footer to be in the same opacity div as well.
http://deadbait.nl/test/

This is my template. I needed the in it to make the opacity thing work.

Code: Select all

{process_pagedata}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>{sitename} - {title}</title>
{metadata}
{stylesheet}
{literal}
	<head>
		<title></title>
		<link href="irrelevant6.css" media="screen" rel="stylesheet">
		<style type="text/css">
#one {
	position:relative;
}
#two, 
#thr {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	min-height: 100%;
}
#two {
	z-index: 1;
}
#thr {
	background: white;
	border: 1px solid black;
	opacity: 0.7;
	filter:alpha(opacity=70);
}
		</style>
{/literal}
	</head>
	</__body>
	    
		<div id="one">
			<div id="two">
			<div id="header">header
                              <div id="menu">   
                               {menu template='cssmenu.tpl' number_of_levels='1'}
                               </div>
                        </div>
      <div class="wrapper">
		<div id="leftcolumn">
		 {content block='Linkerkantje'}
		</div>
		
            <div id="content">
                    <h2>{title}</h2>
                    {content}
                   <br />
	    </div>
         <div id="rightcolumn">{global_content name='sponsors'}</div>
		 	<div class="push"></div>
		</div>
		

      <div class="footer">
            <p>FOOTER TEKST</p>
      </div>
			</div>
			<div id="thr"></div>
		</div>
	<__body>
</__html>
This is my stylesheet:

Code: Select all

* {
	margin: 0;
	padding: 0;
}


.wrapper {
	min-height: 100%;
	height: auto !important;
	height: 100%; 
	margin: 0 auto -100px; /* de margin waarde 'bottom' is de negatieve waarde van de footer grootte, dit is ter compensatie */
}
.footer, .push {
	height: 100px; /* .push moet dezelfde hoogte hebben als .footer */
	border: 1px solid yellow;
	clear:both;
	color: red;
}


html, 
body {
	margin: 0;
	padding: 0;
	height: 100%;
	background: url('uploads/images/img_black_bottom_low_top.png') #000;
	background-repeat: no-repeat;
}
#one {
	width: 900px;
	height: 100%;
	position: absolute !important;
	left: 50%;
	margin: 10px 0 0 -450px;
	background: url('bg2.gif');
	background-repeat: repeat-y;
	}
	
#leftcolumn { 
 color: #333;
 border: 1px solid #ccc;
 margin: 5px 5px 5px 0px;
 width: 170px;
 float: left;
 }
#content { 
 float: left;
 color: #000;
 border: 1px solid #ccc;
 margin: 0px 5px 5px 0px;
 padding: 0px;
 width: 498px;
 display: inline;
}
#rightcolumn { 
 color: #333;
 border: 1px solid #ccc;
 background: none;
 margin: 0px 0px 5px 0px;
 padding: 0px;
 width: 195px;
 float: left;
  display: inline;
}
#header {
width: 900px;
margin: 0 auto;
height: 100px;
border: 1px solid red;
position: relative;
}
Hopefully somebody understands my point and knows a solution. All help is very appreciated.
- Thanks Evert
Last edited by Anonymous on Tue Mar 16, 2010 10:40 am, edited 1 time in total.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Background opacity, everything on top 100% normal

Post by Rolf »

hi evert. you have to put the literal just before the <style...
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Evert B.
Power Poster
Power Poster
Posts: 414
Joined: Fri Oct 20, 2006 12:07 pm

Re: Background opacity, everything on top 100% normal

Post by Evert B. »

Rolf wrote: hi evert. you have to put the literal just before the in inside the div 'thr' which gives the opacity. Only when the content is more then 100% height the opacity div does not grow along.

It's hard enough to explain what I mean in my own language. I hope anyone understands. Just follow the link I'm sure it makes sence then.
]
Thanks - Evert
Peciura

Re: Background opacity, everything on top 100% normal

Post by Peciura »

I think you have to clean up your html a bit
i mean delete duplicate tags
{process_pagedata}



{sitename} - {title}
{metadata}
{stylesheet}
{literal}




#one {
position:relative;
}
#two,
#thr {
position: absolute;
Also remove duplicate styles from CSS generated by {stylesheet} and one you placed in template. e.g.

Code: Select all

#one {
position:relative;
}
and

Code: Select all

#one {
position:absolute !important;
background-color:transparent;
height:100%;
left:50%;
margin:10px 0 0 -450px;
width:900px;
Evert B.
Power Poster
Power Poster
Posts: 414
Joined: Fri Oct 20, 2006 12:07 pm

Re: Background opacity, everything on top 100% normal

Post by Evert B. »

Peciura wrote:Also remove duplicate styles from CSS generated by {stylesheet} and one you placed in template. e.g.

Code: Select all

#one {
position:relative;
}
and

Code: Select all

#one {
position:absolute !important;
background-color:transparent;
height:100%;
left:50%;
margin:10px 0 0 -450px;
width:900px;
Peciura many thanks for your reply. I cleaned up the double tags, thanks.
I purposely added the #one in both template and stylesheet. That is the trick to make the opacity work, with a div inside it that's not opacity. If I delete #one from my template the whole opacity thing s gone.
What other possibilities are there to set height other then 100%? Height: auto; gives me no opacity.

All help is very appreciated.
Thanks - Evert
uniqu3

Re: Background opacity, everything on top 100% normal

Post by uniqu3 »

Hi,

i don't have a fix for your problem but i think this won't work this way since your transparent div #thr is located at the bottom of the source page, the height 100% is actually calculated from the browser height and this works now.
For a quick fix i would recommend you to create a wrapping div around the whole page and a transparent 1px png image, this would work in all major browser and to fix IE6 issue you could use bleated PNG fix.

It may be that i am wrong but this would be fastest solution i can think off.
Evert B.
Power Poster
Power Poster
Posts: 414
Joined: Fri Oct 20, 2006 12:07 pm

Re: Background opacity, everything on top 100% normal

Post by Evert B. »

Hi Unique,

I just tried your idea. I created a div#superwrapper with the following css:

Code: Select all

#superwrapper {
background-image: url('uploads/images/site/trans.gif');
height: auto;
}
Everything is inside this superwrapper. But nothing has changed. Am I doing something wrong here?

Thanks - Evert
Peciura

Re: Background opacity, everything on top 100% normal

Post by Peciura »

Read this blog about floating elements
http://matthewjamestaylor.com/blog/ulti ... xel-widths

Generally i would do some things other way, but you can try to put " " just bellow "..." (at the very end of "#two") and set CSS

Code: Select all

#thr {
...
z-index:-1;}
It is not final solution but you might get some further ideas.
owr_bgld

Re: Background opacity, everything on top 100% normal

Post by owr_bgld »

I'm not shure - but isn't there missing a at the end ?
uniqu3

Re: Background opacity, everything on top 100% normal

Post by uniqu3 »

Looks like it works in firefox now :-)
Evert B.
Power Poster
Power Poster
Posts: 414
Joined: Fri Oct 20, 2006 12:07 pm

Re: Background opacity, everything on top 100% normal

Post by Evert B. »

uniqu3 wrote: Looks like it works in firefox now :-)
Yes indeed it works now in both FF and IE and Chrome. I am very glad with this, now I can develop the rest of the website.

Peciura was right:
Peciura wrote: (...)
but you can try to put " " just bellow "..." (at the very end of "#two") and set CSS

Code: Select all

#thr {
...
z-index:-1;}
It is not final solution but you might get some further ideas.
This actually did the trick, so thank you very much Peciura, and all other for thinking along.

Evert
Post Reply

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