Note that there are some explanatory texts on larger screens.

plurals
  1. POCSS Issue Centering NavBar
    primarykey
    data
    text
    <p>So, essentially the last time I ever did any web-page development, there was only HTML, and I didn't have anymore than a basic understanding anyways. So now, I'm playing catch up and trying to learn CSS. My issue is a horizontal navbar, which doesn't stay perfectly centered. I've tried adjusting widths, and borders, and margins but I'm missing something.</p> <p>With my current layout, there is a tad more whitespace on the left than the right, and I am stuck.</p> <p>Here's the jsfiddle:</p> <p><a href="http://jsfiddle.net/PkvZ7/" rel="nofollow">http://jsfiddle.net/PkvZ7/</a></p> <p>CSS:</p> <pre><code>&lt;!-- JASCO NAVBAR --&gt; ul { width:100%; list-style-type: none; margin-left:auto; margin-right:auto; padding:none; overflow:hidden; } li { align:center; width:20%; margin:0; padding:0; display:inline-block; list-style-type: none; } a:link,a:visited { display:block; width:100%; font-weight:bold; font-size:20px; color:#FFFFFF; background-color:#FF6103; text-align:center; padding:5px; text-decoration:none; font-variant:small-caps; } a:hover,a:active { background-color:#000000; color:#FF6103; } #container { width:100% } &lt;!-- TOP CSS--&gt; .top { position:absolute; width:80%; height:10%; margin-left:auto; margin-top:20px; margin-right:auto; color:#000000; padding:0; } &lt;!-- CONTENT CSS--&gt; .content { position:absolute; width 100%; margin-left:10px; margin-right:10px; padding:3px; color:#dddddd; } #img { } &lt;!-- TOP IMAGE CSS--&gt; img.center { display:block; margin-left:auto; margin-right:auto; } </code></pre> <p>HTML:</p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" type="text/css" href="jascostyle.css"&gt; &lt;title&gt;Single"Frame" Test&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="container"&gt; &lt;center&gt; &lt;div class="top"&gt; &lt;img class ="center" width="80%" height="5%" href="#temp" src="#temp" alt="JASCO ENERGY"/&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#home"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#news"&gt;News&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#contact"&gt;Contact&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#about"&gt;About&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div class="content"&gt; &lt;h1&gt;This is under construction!&lt;/h1&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I appreciate any help/explanation on this matter.</p> <p>Thanks.</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.
    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