Position elements with the div tag

前端 未结 5 1679
失恋的感觉
失恋的感觉 2021-01-28 03:50
5条回答
  •  南笙
    南笙 (楼主)
    2021-01-28 04:15

    There are a few things going on here:

    1. The A element is inline, and things will sit right next to each other, like BlogVideosHomeContactAbout MDB1, as I am sure you have already seen.

    2. This LOOKS like a list or menu, so use the appropriate markup. List markup would be best, or if you want to try HTML5, there is already the NAV element with is specifically for that purpose.

    3. I notice that you are not using URLs in the a elements. It is better to use something which will not generate a 404 on the server.

    4. Why are you bothering with target="_self" unless you are using frames, and if that is the case, please Google for Frames are Evil. If not, then A) _self is redundant, B) if you are using a Strict doctype, the target attribute is deprecated for accessibility reasons.

    5. Naming your CSS file index.css might get you in trouble if the server is configured to use index. with ANY suffix to as the default page. Better would be something like style.css.

    Now to get these things going across, you can go a few ways:

    /* CSS using line list markup */
    #HeadPanel ul {list-style-type:none;}
    #HeadPanel ul li {display:inline; padding:.25em 1em .25em 1em}
    
    /* CSS using floats list markup */
    #HeadPanel ul {list-style-type:none;}
    #HeadPanel ul li {display:block;float:left;margin: 0 .1em 0 .1em;padding:.25em;}
    #HeadPanel ul li a {display:block; /*what ever else you want to do */}
    

提交回复
热议问题