Jump to content

Setting My Floating Div To The Correct Area


dzhax

Recommended Posts

I am having trouble getting my div to go to the correct place.

#layer1 {	position:absolute;	left: 75%;	top: 250px;	visibility: hidden;	width: 200px;	height: 75px;}

Now for my screen this puts to where i need it but on screens with different resolutions it is not.Basically what I was thinking is if i could set the left property to 50% + 340px. This way when it loads, it will put the div 10px off the left side of my main div.First of all is this even possible? and if so how would i accomplish this.

Link to comment
Share on other sites

You would need javascript for that - combining % and px isn't possible with pure CSS. At least, not without adding extra elements. You could possible put the div in question inside another div. Set the first div to left:50% and then simply set the left attribute of the original div to 340px. That might work...

Link to comment
Share on other sites

never thought about that ill give it a try.in the mean time, anyone else have ideas?EDIT:That worked for now. But I would like a cleaner solution if there is one.Website - Click on one of the last played songs to see what I did.Ended up doing this

#layer1 {	position:absolute;	left: 50%;	top: 250px;	margin-left: 360px; // This replaces the left 340px. 340 wasn't enough so 360px was chosen. Also the left property was not working.	visibility: hidden;	height: 75px;}#layer2 {	width: 200px;}

Then i did this

<div id="layer1">	 <div id="layer2">		  Info	 </div></div>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...