Align two inline-blocks left and right on same line

后端 未结 9 788
滥情空心
滥情空心 2020-11-27 11:50

How can I align two inline-blocks so that one is left and the other is right on the same line? Why is this so hard? Is there something like LaTeX\'s \\hfill that can consume

9条回答
  •  悲&欢浪女
    2020-11-27 12:02

    If you don't want to use floats, you're going to have to wrap your nav:

    Title

    ...and add some more specific css:

    header {
    //text-align: center; // will set in js when the nav overflows (i think)
    width:960px;/*Change as needed*/
    height:75px;/*Change as needed*/
    }
    
    h1 {
    display: inline-block;
    margin-top: 0.321em;
    }
    
    #navWrap{
    position:absolute;
    top:50px; /*Change as needed*/
    right:0;
    }
    
    nav {
    display: inline-block;
    vertical-align: baseline;
    }
    

    You may need to do a little more, but that's a start.

提交回复
热议问题