2

I'm building a website where the elements are really only at the bottom. I want my vertical starting place to start at the bottom instead of the top, and I want to do this without taking those elements out of the normal flow of the page (So no absolute positioning) so that the position of one element can depend on the position of the other. How do I do this? Here's a visual explanation of the 'elements at the bottom' thing. https://i.stack.imgur.com/OrPtt.jpg

    <head>
    <style>
        body {
            background: url('Index-Background.jpg') no-repeat center center fixed;
            background-size: cover;
        }
        section {
            margin-left: 2%;
        }
        nav {
            margin-bottom: 6.66%;
        }
    </style>
</head>
<body>
    <main>
        <section>
            <h1>The Great Composers</h1>
            <div>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a pie\sum dolor sit amet..", comes from a line in section 1.10.32.</div>
        </section>
        <nav>
            <ul>
                <li><a href="#0">Gershwin</a></li>
                <li><a href="#0">Debussy</a></li>
            </ul>
        </nav>
    </main>
</body>
Oli
  • 81
  • 2
  • 8
  • could you explain what you mean by "I'm building a website where the elements are really only at the bottom."? – derp Jun 21 '16 at 04:10
  • http://imgur.com/YrzkQfi – Oli Jun 21 '16 at 04:15
  • He just wants his website to follow gravity. What he means by that is that the elements should align automatically from bottom to top instead of the normal behaviour which is top to bottom – noa-dev Jun 21 '16 at 06:30

6 Answers6

1

Well, there are some workarounds. You can do something like this,

html, body {
  height: 100%;
}
body {
  display: table;
}
main {
  display: table-cell;
  vertical-align: bottom;
}

See the working example: https://jsfiddle.net/L1w9m3mz/

Jerad Rutnam
  • 1,536
  • 1
  • 14
  • 29
0

Try to change section and nav orders

<nav>
    <ul>
        <li><a href="#0">Gershwin</a></li>
        <li><a href="#0">Debussy</a></li>
    </ul>
</nav>
<section>
    <h1>The Great Composers</h1>
    <div>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a pie\sum dolor sit amet..", comes from a line in section 1.10.32.</div>
</section>
0

Try this

html, body {
      position: relative; 
     ...
   }
html {
     position: relative;  
     ...
   }

Edit: This might help. How can I position my div at the bottom of its container?

Community
  • 1
  • 1
anjali
  • 93
  • 1
  • 2
  • 11
0

Hmm, i'm still not entirely sure what you want to achieve, however if you are trying to make the nav bar horizontal. You'll need to add the following css:

li {
  display: inline-block;
  padding-right:10px;
}
derp
  • 2,300
  • 13
  • 20
0

How about using position:fixed to set the nav positioning. Here are the what i conclude from the image you attached : JSFiddle

Johan Pranata
  • 317
  • 2
  • 9
0

use flexbox - all modern browsers support
add .reverse where you want to reverse.

http://caniuse.com/#search=flexbox

.reverse {
     display: flex;
     flex-direction: column-reverse;
  }