centering a div between one that's floated right and one that's floated left

后端 未结 7 1183
天命终不由人
天命终不由人 2020-12-02 14:04

I have a page in which a header consists of three divs - one that\'s floated to the left, one that\'s floated to the right, and one that\'s in between them. I\'d like for th

7条回答
  •  鱼传尺愫
    2020-12-02 14:30

    Indeed, the important part is that the centered div come after the left and right divs in the markup. Check out this example, it uses margin-left: auto and margin-right: auto on the centered div, which causes it to be centered.

    
    
        
    
    
    
        
    left
    mid

    Here's a JS Bin to test: http://jsbin.com/agewes/1/edit

提交回复
热议问题