1

I'm trying to make a fixed div adjacent to a scrolling div, such as Fixed div next to a centered div asks. I've looked at that one and Fixed div next to parent div, but it doesn't seem to work on what I'm doing. Here's the code for what I'm working on (without any code for what I'm trying to make): http://jsfiddle.net/Firedrake969/dbLt9/

I've tried

float:left;

but it doesn't work with

position:fixed;

Also, on a tangent, the background div, as it is fixed, does not let you scroll the page.

Community
  • 1
  • 1
Firedrake969
  • 763
  • 8
  • 22

2 Answers2

1

FIDDLE here
^ Above is the updated link of your code.

Discuss:
You don't need to define height and position in #back div. Just remove them from CSS. You may see an automated margin added by the browser itself. To override this set margin: 0; to the body.

Also on your #intro div you are using top: 20px; which makes this div overflowing it's parent. Instead you can just use margin-top: 20px;

aniskhan001
  • 7,981
  • 8
  • 36
  • 57
0

Please, try it.

jsfiddle

or, maybe you wanted this: jsfiddle

#top {
    text-align:center;
    background: aliceblue;
    position: fixed;
    width:100%;
    top:0;
    height: 30px;
}
#menu {
    background-color:#8F8E94;        
    font-size:35px;
    margin-top:30px;
}
<div id='top'>Welcome!</div>
<div id='menu'>
Menu <br>
Lorem ipsum dolos accusata pericula. Nonumy saperet alienum per ne, an nam mutat autem, vel diam evertitur sadipscing eu. Errem graece cotidieque an pri. Per et idque populo luptatum.
<br>
Lorem ipsum dolos accusata pericula. Nonumy saperet alienum per ne, an nam mutat autem, vel diam evertitur sadipscing eu. Errem graece cotidieque an pri. Per et idque populo luptatum.
<br>
Lorem ipsum dolos accusata pericula. Nonumy saperet alienum per ne, an nam mutat autem, vel diam evertitur sadipscing eu. Errem graece cotidieque an pri. Per et idque populo luptatum.
<br>
Lorem ipsum dolos accusata pericula. Nonumy saperet alienum per ne, an nam mutat autem, vel diam evertitur sadipscing eu. Errem graece cotidieque an pri. Per et idque populo luptatum.

</div>
Yevgeniy Afanasyev
  • 37,872
  • 26
  • 173
  • 191