Forum Moderators: not2easy
well my simple qustion is; how can i make a layer?
i want to make a floating layer so it wont move..
the big thing is that i want my main menu to only change the pages in that layer.. and the main frame/background will allways stays..
hope i get that right, but here's an example of a site like that:
<No URLs, thanks. See TOS [WebmasterWorld.com] and CSS Forum Charter [WebmasterWorld.com]>
if u click on the menu up top..u'll see that the only thing changing is whats in the frame..im pretty sure it's a lyaer (if not so tell me)
PLEASE HELP ME..IM LOSING HOPE :(
[edited by: DrDoc at 6:20 pm (utc) on Oct. 5, 2004]
The easiest way of doing that is by using an iframe.
i need to see an example
let's say i want to float this image-
<snip>
what code do i need?
[edited by: engine at 11:53 am (utc) on Oct. 6, 2004]
[edit reason] No urls, thanks. See TOS [webmasterworld.com] [/edit]
SO you have a text div and an image and you want them side by side. First, order the source code so that the floated element is first...
<img class="floatedimage" src="image.gif" />
<div id="textdiv">Content text.</div>
Next, in your stylesheet, style the image to float. Here I'll move it to the right of the text div, but it could just as easily go left...
.floatedimage {
float: right;
width: WHATEVER;
}
That's it. The image will be placed in the flow, the lifted out and moved to the right until it hits the edge of the containing block. Then the text <div> will be placed and filled. Any text that is longer than the image will wrap underneath it. If you don't want this, style the text div like so...
#textdiv {
margin-right: WHATEVER; /*equal to width of the floated image*/
}
This will line up the text and image into two neat columns.
Bear in mind this is a SIMPLE example. I can't possibly code around all the problems you might run into without knowing exactly what's going on on your page (for instance, you'll need to clear the float in whatever element comes after these elements in your code, and other strange things can happen depending on whether or not these elements are inside of a container box or not). Play around with it and keep reading float tutorials. Search for answers to specific questions on WebmasterWorld. Floats can be tricky at first, but once you understand how they work the mystery goes away.
Some basic float info is also covered in this thread [webmasterworld.com].