Search code examples
htmlcssblogger

Can't remove white space (left and right sides) from Navbar


I am very new to HTML programming. I was creating my first navigation bar using blogger and I can't remove default white space (left and right sides) set by blogger. Here is my blog link. I did use browser inspect tool also but I can't find what is causing the problem. Here's my blogger link: https://nainghtooaung2.blogspot.com/

I did use position:relative; to adjust alignment.Although the codes move the navigation bar to left without any white space, it will create more white space on the right side. This means the code I use just move the position of the navigation bar, but didn't remove the white space.

When I tried to use position:fixed, It remove all the white space from navigation bar. But my navigation bar overlapped with other contents.

.site-nav {
position:relative;
left:0;
width:100%
)

.site-nav {
position:fixed;
left:0;
width:100%
)

Solution

  • Always add browser reset CSS code in the beginning of your style sheet:

    html, body, div, span, applet, object, iframe,
    h1, h2, h3, h4, h5, h6, p, blockquote, pre,
    a, abbr, acronym, address, big, cite, code,
    del, dfn, em, img, ins, kbd, q, s, samp,
    small, strike, strong, sub, sup, tt, var,
    b, u, i, center,
    dl, dt, dd, ol, ul, li,
    fieldset, form, label, legend,
    table, caption, tbody, tfoot, thead, tr, th, td,
    article, aside, canvas, details, embed, 
    figure, figcaption, footer, header, hgroup, 
    menu, nav, output, ruby, section, summary,
    time, mark, audio, video {
        margin: 0;
        padding: 0;
        border: 0;
        font-size: 100%;
        font: inherit;
        vertical-align: baseline;
    }
    /* HTML5 display-role reset for older browsers */
    article, aside, details, figcaption, figure, 
    footer, header, hgroup, menu, nav, section {
        display: block;
    }
    body {
        line-height: 1;
    }
    ol, ul {
        list-style: none;
    }
    blockquote, q {
        quotes: none;
    }
    blockquote:before, blockquote:after,
    q:before, q:after {
        content: '';
        content: none;
    }
    table {
        border-collapse: collapse;
        border-spacing: 0;
    }