Container fix width. Center div dynamic width. want left right divs to fill out remaining width equally

前端 未结 1 801
难免孤独
难免孤独 2021-01-23 08:17

Have Three columns..Combine width of all three is fixed.. 2nd ( center ) column will have dynamic content.. I need left and right column to fill out remaining space ( container

1条回答
  •  不思量自难忘°
    2021-01-23 08:45

    If you need the left and right columns just for setting the background, then most probably, you don't even need them at all.

    Simply setting the background on the .container, giving the same container text-align: center, making the center column inline-block and reseting the background and text-align on it will do the trick.

    demo

    HTML:

    booooo add remove text here

    CSS:

    .container {
        background: #ccc;
        text-align: center;
    }
    .c {
        display: inline-block;
        background: white;
        text-align: left;
    }
    

    0 讨论(0)
提交回复
热议问题