CSS: making a div float OVER another div

I have a webpage with a div named "#Block1", containing two divs named "#topLeft" and "#topRight."  

Is it possible to put a button in #topLeft that brings up a div named "#descriptionLong" (height and width of 280px), and floats it centered over #Block1?

If so, how?

Thanks!

John
#Block1{
	height: 320px;
	width: 890px;
	float: left;
  }
#topLeft {
	width: 50%;
	height: 300px;
	font-family: "Arial Black";
	font-size: 24px;
        margin-top: 30px
	line-height: normal;
	color: #000000;
	font-weight: normal;
	float: left;
	padding-top: 20px;
	background-color: #FFFFFF;
  }
#topRight{
	width: 50%;
	height: 300px;
	float: left;
	color: #FFFFFF;
	font-family: "Gill Sans MT";
	line-height: normal;
	font-size: 12px;
	text-align: center;
	margin-top: 42;
	margin-left: auto;
	background-color: #000000;
	padding-top: 20px;
	background-image: url(iPodDock.jpg);
	background-repeat: no-repeat;
	background-position: center center;
  }
  #descriptionLong {
	font-family: "Gill Sans MT";
	font-size: 14px;
	float: left;
	width: 280px;
	height: 280px;
	color: #000000;
	padding-left: 10px;	
	background-color:#FFFFFF
  }
 
HTML CODE:
		<div id="Block1">	
            <div id="topLeft">
                <div id="product">text here		</div>
                <div id="price">$119.99		</div>      
                <div id="shipping">+$5 shipping		</div>
                <div id="holder1">	
                    <div id="conditions">Condition:<br />Product(s):		</div>
                    <div id="descriptionShort">New<br />text here</div>
                </div>	<!-- end holder1 -->  
            </div>	<!-- end topLeft -->      
            <div id="topRight"></div>	<!-- end topRight -->
		</div>	<!-- end "mainBlock" -->

Open in new window

LVL 1
John CarneyReliability Business Tools Analyst IIAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

grendel777Commented:
Hi John, the easiest way to do it is to simply create the <div> and place it where you want it to show up, then set it to
   visibility: hidden
Have the button change it to
   visibility: visible

See http://www.w3schools.com/css/pr_class_visibility.asp for details on the visibility property.

HTH!
0
Jason C. LevineNo oneCommented:
>> Have the button change it to  visibility: visible

So this needs javascript...(in case that was your next question, John)
0
scrathcyboyCommented:
you can use either float or absolute positioning, if you are not worried about them visually overlapping, as in a background image with text over it.  If you use the latter, you can simply declare all your DIVs one after the other, and then position them where you want to with CSS.  Keep in mind, there is the problem of different browsers rendering absolute position different than each other, as well as the problem of items overlapping one another, but if that is your intent, and you can debug the X-browser issues, use absolute positioning, by all means -- one DIV or SPAN per element, and fiddle the absolute until it looks as you want it in all browsers.  
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

John CarneyReliability Business Tools Analyst IIAuthor Commented:
This al looks very promising.  I figured it would be a visibilty on/off thing like in VBA. My first question would be: how do I position a div to float free over other divs without messing them up.

Can't wait to start trying out your suggestions and any more you might have over the weekend.

Thanks!

John
0
scrathcyboyCommented:
"how do I position a div to float free over other divs without messing them up."

as I said, use absolute positioning in the DIV and it will position more or less to that place, depending on the browser you are using.  Else put the DIV where you want it, if you want a full row to show, or use <SPAN> if you just want a short part of the row to show, and toggle its visibiliity on or off.
0
John CarneyReliability Business Tools Analyst IIAuthor Commented:
grendel777, thanks for the link. I couldn't make sense of it, but it prompted me to google some phrases which eventually led me to a site where I found code samples that with a little tinkering produced exactly the result I was looking for. Even though it's a very beginner-friendly site, I think you might find some useful or interesting things on it: http://bonrouge.com

Jason, thanks for pointing out the fact that I needed javascript (of which I now actually have a minimal understanding!)

And scratchyboy, thanks for pointing out the need for absolute positioning.

The big problem I'm having now is incorporating it into my existing code. Please take a look at "test2.html," and let me know what I'm doing wrong in "CowBoom_Toggle.html."  They both have links to their respective .css an .js docs, if the problem is in one of those.

http://www.discretedata.com/Ex-Ex/test2.html
http://www.discretedata.com/Ex-Ex/CowBoom_Toggle.html

Thanks!

John




0
Jason C. LevineNo oneCommented:
John,

I took a look at bonrouge's stuff and the problem I think you are having is that the sample you used was his basic sample that had minimal elements on the page.  Because your page is complex, with multiple ID tags, there may be too many elements for the simple js to work.

You should continue reading his tutorials and get the to the more advanced one where he talks about the function toggleNextByIdAndTag()

If I'm following his logic correctly, he's designating which tags and IDs are toggled by passing it through the onLoad() event.  
0
John CarneyReliability Business Tools Analyst IIAuthor Commented:
Jason, could you give me the link to that page on his site? I'm not having any luck finding it.
Thanks, John
0
Jason C. LevineNo oneCommented:
http://bonrouge.com/~togglit

Read all the way down the page to see how the script gets progressively more complex.
0
John CarneyReliability Business Tools Analyst IIAuthor Commented:
Excellent suggestion. I probably won't have time again til Monday to work on it. I actually tried using all the code before, but I  probably copied and pasted something wrong.  Hopefully, when i'm more careful and deliberate, and know a little more about how it works, all the code on that page will be enough to handle what's going on in my page.

Oh and thanks for getting me started with javascript.

John
0
Jason C. LevineNo oneCommented:
You're welcome.

As you read through his examples, pay attention to how he puts actual tags and ID's in the javascript function to allow the popup to work and doesn't add visibility or display to the CSS.  The javascript handles all of that.

By the way, you don't use visibility for this instance, you use display: block and display: none.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.