Welcome to WebmasterWorld Guest from 54.145.209.34

Forum Moderators: not2easy

Having a movable div that floats

   
1:50 pm on Mar 19, 2013 (gmt 0)

5+ Year Member



I'm not exactly sure how to explain this. Let's say I have a 250x250x div (that holds an ad), that I currently have at the top of the page.

What I want to do is have more flexibility so that I can change where in the page (vertically) it appears via css to test various locations. I've been trying to do this using various positioning options, but all I can get is the div to sit on top of the larger text block, rather than it floating and the large text block making room for it.

I don't want to move the code itself. I just want to be able to make it appear lower or higher on the page simply by altering the css.

This should be possible? I've worked on this over the last while on and off for months (ok, it's a learning experience), but I simply can't get it.

Can anyone point me in the right direction?
3:39 pm on Mar 19, 2013 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry, but you can't eliminate the relationship between where your content resides within an HTML document and its effect on how adjacent content is displayed using CSS alone. You could, however, modify the document itself with JavaScript and move selected sections of HTML from one location to another.
6:47 pm on Mar 19, 2013 (gmt 0)

5+ Year Member



Thanks Rainborick, at least I can stop struggling with doing it that way. Since I'm not a javascript programmer, any idea if there's some code I can scrounge to try to modify.

The task, on the surface of it is simple -- to have a block that the main text will wrap around, and to be able to move the block occasionally with respect to how far down the page it is displayed. It's primarily to get some ads from the top to the middle, without actually doing the whole thing manually for thousands of pages.
10:13 pm on Mar 19, 2013 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



I don't want to move the code itself. I just want to be able to make it appear lower or higher on the page simply by altering the css.

Floats by definition display as soon as they can. Either right away, or after any preceding floats are finished; that's the only variable. So you can only move it by physically moving the code.

It may help to remember that HTML+CSS isn't a programming language. It's "only" a fairly sophisticated word processor.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month