Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

side nav bar

  • 26-11-2011 09:10PM
    #1
    Registered Users, Registered Users 2 Posts: 210 ✭✭


    Hi

    i am making a side nav bar with a unordered list inside a div,


    you know when you make a list it all way pushes over to the right abit is there any way of stoping this i want the list tight up to the left of the div???


Comments

  • Registered Users, Registered Users 2 Posts: 125 ✭✭ivanc


    pjwhite99 wrote: »
    Hi

    i am making a side nav bar with a unordered list inside a div,


    you know when you make a list it all way pushes over to the right abit is there any way of stoping this i want the list tight up to the left of the div???

    Put a negative margin on the li.


  • Registered Users, Registered Users 2 Posts: 4,468 ✭✭✭matt-dublin


    put a 0 margin on the ul and a 0 margin on the li

    you shouln't use negative margins.


  • Registered Users, Registered Users 2 Posts: 210 ✭✭pjwhite99


    put a 0 margin on the ul and a 0 margin on the li

    still never worked this is what i have done



    #side_links ul li {
    line-height: 35px;
    font-family: "Times New Roman", Times, serif;
    font-size: 16px;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: #27C3F3;
    color: #8E6C3E;
    list-style-position: inside;
    list-style-image: url(../images/arrow.png);
    font-weight: bold;
    margin: 0px;
    width: 140px;
    }

    any ideas?


  • Registered Users, Registered Users 2 Posts: 4,468 ✭✭✭matt-dublin


    can you post both the html and css?

    it sounds like the container the list is in had padding.

    also try
    padding-left: 0px;

    in bothe the ul and li css


  • Registered Users, Registered Users 2 Posts: 11,088 ✭✭✭✭28064212


    pjwhite99 wrote: »
    still never worked this is what i have done

    #side_links ul li {
    Just to be sure, is side_links the name of the ul or the div above the ul? Also, that CSS only applys to the li elements, not the ul. Set the padding-left and margin-left of both to 0px

    Boardsie Enhancement Suite - a browser extension to make using Boards on desktop a better experience (includes full-width display, keyboard shortcuts, dark mode, and more). Now available through your browser's extension store.

    Firefox: https://addons.mozilla.org/addon/boardsie-enhancement-suite/

    Chrome/Edge/Opera: https://chromewebstore.google.com/detail/boardsie-enhancement-suit/bbgnmnfagihoohjkofdnofcfmkpdmmce



  • Advertisement
  • Registered Users, Registered Users 2 Posts: 125 ✭✭ivanc


    you shouln't use negative margins.

    The use of negative margins is perfectly valid mark up and solves a lot of those little issues like the indent when using an unordered list.


  • Closed Accounts Posts: 9,698 ✭✭✭tricky D


    It is explicitly allowed in the spec, but not for padding which is explicitly not allowed.


  • Registered Users, Registered Users 2 Posts: 4,468 ✭✭✭matt-dublin


    ivanc wrote: »
    The use of negative margins is perfectly valid mark up and solves a lot of those little issues like the indent when using an unordered list.
    it does work you're right, but if you need to use - margins and padding then you should have a look at all of your container positioning and padding.

    in theory you should never have to use it if everything is structured correctly


  • Registered Users, Registered Users 2 Posts: 210 ✭✭pjwhite99


    28064212 wrote: »
    Just to be sure, is side_links the name of the ul or the div above the ul? Also, that CSS only applys to the li elements, not the ul. Set the padding-left and margin-left of both to 0px

    i needed to use #side_links ul works fine now thanks


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    put a 0 margin on the ul and a 0 margin on the li

    you shouln't use negative margins.

    Huh ?
    position:absolute;left:50%;width:950px;margin-left:-475px
    

    is a perfectly acceptable CSS-based method of centering a popup overlay on an unknown screen size


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 4,468 ✭✭✭matt-dublin


    why wouldn't you just use an auto margin for that? wouldn't it centre without the added bloat?
    margin:auto; width:950px;


  • Registered Users, Registered Users 2 Posts: 12,025 ✭✭✭✭Giblet


    Negative margins should only be used when you need to move something into a defined margin outside the regular flow of a document, centered absolutely positioned elements require it in some cases too, but never just to get something into position without considering how it will affect the flow of the doc.. For a UL, just set margin to 0.

    margin:auto only works when you have a width for the container.


  • Closed Accounts Posts: 9,698 ✭✭✭tricky D




  • Registered Users, Registered Users 2 Posts: 4,468 ✭✭✭matt-dublin


    Dreamweaver doesn’t understand it
    Negative margins don’t show up in the Design View of DW. Why are you even checking your site in Design View anyway?

    excellent.


  • Closed Accounts Posts: 9,698 ✭✭✭tricky D


    Yup, that raised a chuckle from me also.


Advertisement