How can i Display div Elements in one row

前端 未结 5 447
无人共我
无人共我 2021-01-24 12:03

Hi everyone i want o display 3 elements in a row. I have tried the following code but it is not displaying them correctly.

    
5条回答
  •  无人共我
    2021-01-24 12:27

    Add display: inline-block; to the child divs.

    Set the height of the child divs:

    1. Possibility: Set the height for all the child divs: height: 20px /* or in %, em, etc */;
    2. Possibility: Set the height for the child divs: height: inherit; which gives the height from the parent div to the children divs

    From W3Schools:

    The inherit keyword specifies that a property should inherit its value from its parent element.

    The inherit keyword can be used for any CSS property, and on any HTML element.

提交回复
热议问题