css divide width 100% to 3 column

前端 未结 11 641
余生分开走
余生分开走 2020-12-12 21:38

I have a layout where I have 3 columns.

Therefore, I divide 100% by 3.

The result is obviously 33.333....

My goal is perfect

11条回答
  •  难免孤独
    2020-12-12 22:30

    A perfect 1/3 cannot exist in CSS with full cross browser support (anything below IE9). I personally would do: (It's not the perfect solution, but it's about as good as you'll get for all browsers)

    #c1, #c2 {
        width: 33%;
    }
    
    #c3 {
        width: auto;
    }
    

提交回复
热议问题