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

后端 未结 7 1186
天命终不由人
天命终不由人 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:35

    The element with the centered content needs to be specified after both floated elements. After that, simply set the middle element to text-align: center. The text in the centered element will squeeze in between the floats.

    See here: http://jsfiddle.net/calvintennant/wjjeR/

提交回复
热议问题