Get the App
SLTechnology News&Howtos  ›  Development  › 

How to make the two DIV arrange horizontally

Shulou Source: shulou.com Published: 2022-06-02 11:44:33 10月03日 Update

How to achieve the horizontal arrangement of the two DIV, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

How to define how to arrange two DIV horizontally

Two DIV horizontal arrangement method one:

In general, the default DIV is to write a new line, so how do you define the horizontal arrangement of two DIV without wrapping?

The default display property for DIV is block. So every DIV is a new line, and now replacing display with inline will not change the new line.

< div styledivstyle="background-color:#ff0000;display:inline;">

Aaa bbb

Two DIV horizontal arrangement method 2:

The float:right attribute is used here. Float, as an attribute in CSS, defines in which direction the element floats. The float:right text or image moves to the right in the parent element.

Note that the float attribute must be used in conjunction with width, otherwise it will become invalid.

Number of readings: 9999 release date: 2009-09-10. BG10 {background-image:url (.. / images/news_r6_c4.jpg); height:24px; line-height:24px; color:#939393;}

Height:24px; and line-height:24px; are highly consistent, with text centered vertically.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Tags: Two horizontal attribute one line element situation method help clear consistent content right image for this text text article novice direction date Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Microsoft Shulou Technology Huawei Apple