Note that there are some explanatory texts on larger screens.

plurals
  1. POCSS Can only style elements with pixels, not percents
    primarykey
    data
    text
    <p>i'm having a bit of a brain melting problem. I have a master div thats pretty much the body (don't ask me why, i was getting desperate), and within that div is a head div, and within that div is the navigation bar. It's a clear hierarchy. The problem is, whenever i try to use percents to adjust the height and width of the navigation bar or the head div, nothing happens. Zip, zero, nada. I've tried changing the positions to absolute, relative, even static. I've removed the Master Div, i've reordered the hierarchy, but nothing seems to work. Eventually i got to the point where i figured out that when i used pixels, i got the change wanted. (Obviously had to do a bit of conversion). My first thought was hierarchy, but again, it's clear, with no missing ending tags, no weird parents or children. HTML</p> <pre><code>&lt;div id="master_div"&gt; &lt;div id="head_div"&gt; &lt;div id="title_div"&gt; &lt;p id="title"&gt;A Challenging Sew&lt;/p&gt; &lt;p id="subtitle"&gt;A sewing room, Venti Starbucks and a iPod classic....with a weekly Monday update to keep me on task....lets see what happens....&lt;/p&gt; &lt;/div&gt; &lt;div id="nav_bar"&gt; &lt;ul&gt; &lt;li&gt;&lt;a class="nav_bar_links" href="/home"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="nav_bar_links" href="/about"&gt;About&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="nav_bar_links" href="/projects/2013"&gt;Projects for 2013/2014&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="nav_bar_links" href="http://www.flickr.com/photos/91959855@N02/collections/72157632507621761/"&gt;Completed&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="nav_bar_links" href="/archive"&gt;Archives&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="nav_bar_links" href="/subscribe"&gt;Subscribe&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="nav_bar_links" id="sign_in" href="#"&gt;Sign In&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>CSS</p> <pre><code>body { font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 15px; padding:0 !important; } #master_div { position:relative; width:100%; height:100%; margin:0; padding:0; } /* Navigation Page */ #scary_tree { position:absolute; right:40%; top:25%; } /* Home */ /* TODO: Make Responsive Home Page */ #head_div { background-color:whitesmoke; position:absolute; height:63px; width:100%; margin:0; padding:0; } /* A Challenging Sew + A sewing room, Venti Starbucks and a iPod classic..*/ #title_div { background-color:white; opacity: .7; position:relative; height:30px; width:100%; top:15px; border-top: solid 1px #e7e7e7; border-bottom: solid 1px #e7e7e7; } #title { position:absolute; left:3%; top:-9%; font-size:100%; margin:0; padding:0; } #subtitle { position:absolute; left:3%; top:50%; padding:0; margin:0; font-size:40%; line-height: 1.2; } #nav_bar { position:absolute; top:100%; height:15%; width:100%; background-color:whitesmoke; border-top: solid 1px #e7e7e7; border-bottom: solid 1px #e7e7e7; margin:0; padding:0; } #nav_bar ul { margin:0; padding:0; position:relative; height:20px; top:-8px; } #nav_bar li { display:inline; } #nav_bar a:link,a:visited { margin:0; padding-left:5px; text-decoration: none; color: black; font-size:50%; } #nav_bar #sign_in { position:absolute; right:2%; top:3px; margin:0; padding:0; } </code></pre> <p>Note: I am using a reset file. However, i still have margin and padding :0 in there because it doesn't really seem to be taking hold. </p> <p>Feel free to critique me on my coding style, still learning!</p>
    singulars
    1. This table or related slice is empty.
    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.
    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