Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to vertically center elements in Zurb Foundation?
    primarykey
    data
    text
    <p>I am building a login form and I want the username and password fields square in the middle of the screen. I am also using the Zurb Foundation package to build this form. I am having a lot of trouble centering things vertically. </p> <p>Here is my code:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ --&gt; &lt;!--[if lt IE 7]&gt; &lt;html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"&gt; &lt;![endif]--&gt; &lt;!--[if IE 7]&gt; &lt;html class="no-js lt-ie9 lt-ie8" lang="en"&gt; &lt;![endif]--&gt; &lt;!--[if IE 8]&gt; &lt;html class="no-js lt-ie9" lang="en"&gt; &lt;![endif]--&gt; &lt;!--[if gt IE 8]&gt;&lt;!--&gt; &lt;html class="no-js" lang="en"&gt; &lt;!--&lt;![endif]--&gt; &lt;head&gt; &lt;meta charset="utf-8" /&gt; &lt;!-- Set the viewport width to device width for mobile --&gt; &lt;meta name="viewport" content="width=device-width" /&gt; &lt;title&gt; Registration &lt;/title&gt; &lt;!-- Included CSS Files (Compressed) --&gt; &lt;link rel="stylesheet" href="stylesheets/foundation.min.css"&gt; &lt;link rel="stylesheet" href="stylesheets/app.css"&gt; &lt;link rel="stylesheet" href="stylesheets/main.css"&gt; &lt;script src="javascripts/modernizr.foundation.js"&gt;&lt;/script&gt; &lt;!-- IE Fix for HTML5 Tags --&gt; &lt;!--[if lt IE 9]&gt; &lt;script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"&gt;&lt;/script&gt; &lt;![endif]--&gt; &lt;/head&gt; &lt;nav class="top-bar"&gt; &lt;ul&gt; &lt;li class="name"&gt;&lt;h1&gt;&lt;a href="#"&gt;Title&lt;/a&gt;&lt;/h1&gt;&lt;/li&gt; &lt;li class="toggle-topbar"&gt;&lt;a href="#"&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;section&gt; &lt;ul class="left"&gt; &lt;li&gt;&lt;a href="#"&gt;Link&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;ul class="right"&gt; &lt;li&gt;&lt;a href="#"&gt;Link&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/section&gt; &lt;/nav&gt; &lt;body&gt; &lt;div class="row" id="parent"&gt; &lt;div class="six columns" id="child"&gt; &lt;form id = "register"&gt; &lt;input type="text"&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;script src="javascripts/jquery.foundation.topbar.js"&gt;&lt;/script&gt; &lt;!-- Included JS Files (Compressed) --&gt; &lt;script src="javascripts/jquery.js"&gt;&lt;/script&gt; &lt;script src="javascripts/foundation.min.js"&gt;&lt;/script&gt; &lt;!-- Initialize JS Plugins --&gt; &lt;script src="javascripts/app.js"&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>And some CSS that I've played around with, but haven't gotten to work yet: </p> <pre><code>body { /*background-image: url('../images/gplaypattern.png');*/ background: red; } #register { background-color: black; width:80%; } #parent { position: absolute; left: 50%; top: 50%; height: 80px; } #child { height: 75px; position:absolute; top: 50%; background: green; } </code></pre> <p>Wierdly, if I change the height of something to be dynamic (i.e. <code>height: 30%;</code>) it does not work, why?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload