Welcome to WebmasterWorld Guest from 54.196.147.57

Forum Moderators: not2easy

Message Too Old, No Replies

2nd container "migrates:

     

Another_Rob

8:14 am on Jun 27, 2014 (gmt 0)



I have 2 containers as menu menu holders fixed at 0em. The idea is so that they stay put as the page scrolls under them. Trouble is the 2nd container (#test-container) "migrates" when the size of the page is changed (ie using Ctrl + Ctrl -). The only difference between the 2 containers is the
right:400px;
.How can I stop this happening ?
<!DOCTYPE html> 
<html>
<head>
<title>test Page</title>


<style>
body{
margin:0px;
font-family:"Trebuchet MS",Arial,sans-serif;
font-size: 15px;
color:#000000;
background-color:#666678;
}

.PAGE-container{
position:relative;
width: 1000px;
background-color: #e7e7e7;
margin-top: 0px;
margin-right: auto;
margin-bottom: 15px;
margin-left: auto;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-right-color: #FFFFFF;
border-bottom-color: #FFFFFF;
border-left-color: #FFFFFF;

}

.CONTENT-container{
padding: 20px;
overflow: hidden;
width: 959px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-right-color: #FFFFFF;
border-bottom-color: #FFFFFF;
border-left-color: #FFFFFF;
}
.top-container{
height: 150px;
padding: 20px;
font-size: 30px;
background-color: #e7e7e7;
overflow: hidden;
width: 959px;
border-right-width: 1px;
border-right-style: solid;
border-right-color: #FFFFFF;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #e7e7e7;
border-left-width: 1px;
border-left-style: solid;
border-top-color: #FFFFFF;
border-left-color: #FFFFFF;
}
#menu-container{
position:fixed;
top:0em;
padding:0.2em 0.3em 0.1em 0.4em;
background:#67A897;
border-radius: 5px;
z-index: 2;
}


#test-container{
position:fixed;
right:400px;
width:200px;
top:0em;
padding:0.2em 0.3em 0.1em 0.4em;
background:blue;
border-radius: 5px;
z-index: 2;
}
</style>
</head>
<body>
<div class="PAGE-container">

<div class="top-container">
<div id="test-container">
<p>top top </p>
</div>

<div id="menu-container">
<ul id="nav">
<li><a href ="../index.html" title="Main Index Page">Home</a></li>
<li class="current">
<a href="Rxfirst.html">Rally </a></li>
<li><a href="mailto:xxxxxxxxx ?subject=RX">Contact Me</a></li>
</ul>
</div>
</div>

<div class="CONTENT-container">
<p> say something
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eu
m iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et
iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis
eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis
in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus
dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit
litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes
in futurum.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eu
m iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et
iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis
eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis
in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus
dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit
litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes
in futurum.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eu
m iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et
iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis
eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis
in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus
dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit
litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes
in futurum.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eu
m iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et
iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis
eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis
in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus
dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit
litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes
in futurum.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eu
m iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et
iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis
eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis
in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus
dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit
litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes
in futurum.
</p>
</div>
</div>
</html>

Fotiman

2:07 pm on Jun 27, 2014 (gmt 0)

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month




Trouble is the 2nd container (#test-container) "migrates" when the size of the page is changed (ie using Ctrl + Ctrl -)

Also when resizing the browser window. The menu will appear in different locations relative to the other menu and the page content (though always 400px from the right edge). The problem is that right: 400px; Since you're aligning that against the right side of the window, it will always appear inconsistent with the rest of your content, which (in a left-to-right locale like English) will be aligned from the left.

One option would be to remove the right: 400px, and instead give #test-container a margin-left value to push it to the right of the other fixed box.

Another_Rob

8:50 pm on Jun 27, 2014 (gmt 0)



Thanks Fotiman but I have tried that... it is just the same :( . Also tried having it as % but it still does it. If I make the postion:relative and left or right:200px it stays put, but it also scrolls up with the rest of the page

Fotiman

2:22 am on Jun 28, 2014 (gmt 0)

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



Well I did exactly what i suggested using the browser tools to replace the styles on your page and it worked. So I'm guessing maybe you applied them to the wrong selector or your browser was showing a cached version of your styles.

Another_Rob

6:59 am on Jun 28, 2014 (gmt 0)



Fotiman
Ooops..embarrassed....I miss read your suggestion. You are right, margin-left works.

Thanks

Fotiman

4:59 am on Jun 29, 2014 (gmt 0)

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



:)
Glad you got it working.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month