Jump to content
  • Advertisement
Sign in to follow this  
Fl4sh

[web] how do I move divs?

This topic is 3087 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

http://i50.tinypic.com/2qs70k5.jpg

In the photo above, I'm trying to push the search bar down to meet the border of the center box. I want it sitting right on the top of it....I just can't find what css settings accomplishes this.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Fl4sh
I just can't find what css settings accomplishes this.

C'mon:

* google: css set position
-> 1st result

After your other question, my serious advice is that you get used to using search engines. On average, for questions like this, it will cost you less time than starting forum threads.

Share this post


Link to post
Share on other sites
The easiest way to shuffle divs around is to give them absolute positioning, and twiddle with the top/left properties.


var oDiv = document.getElementById("theDiv");

// Position absolute
oDiv.style.position = "absolute";

// Make sure it has dimensions
oDiv.style.width = "100px";
oDiv.style.height = "100px";

// Top left corner of the screen
oDiv.style.left = "0px";
oDiv.style.top = "0px";


If you don't understand why the absolute positioning, or things like box model, I strongly urge you to brush up on understanding divs.

Share this post


Link to post
Share on other sites
Quote:
Original post by stormwarestudios
The easiest way to shuffle divs around is to give them absolute positioning, and twiddle with the top/left properties.


var oDiv = document.getElementById("theDiv");

// Position absolute
oDiv.style.position = "absolute";

// Make sure it has dimensions
oDiv.style.width = "100px";
oDiv.style.height = "100px";

// Top left corner of the screen
oDiv.style.left = "0px";
oDiv.style.top = "0px";


If you don't understand why the absolute positioning, or things like box model, I strongly urge you to brush up on understanding divs.


I think the OP was asking about CSS, not ECMAScript ;)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!