How to resolve float:right right-aligned elements in CSS wrap lines not on the same line

Source: Internet
Author: User
This article mainly introduces about how to solve the CSS in float:right right alignment elements will be wrapped not on the same line, has a certain reference value, now share to everyone, there is a need for friends can refer to

Using float to set the right-aligned display, we usually encounter, the right-aligned elements will be wrapped, so that the left and then the elements are not on the same line, the following for you to introduce the next two solutions, a similar situation of friends can refer to the next

CSS usually we need to put an element left, the right to display, this time we can be set according to the float, when the right to set the display, we usually encounter, right-aligned elements will be wrapped, so that there will be the left and then the element is not on the same line, we can solve the problem by the following ways:

The First solution: swap left and right, for example, put the date in front of the title, swap it out.

The Second solution: add Float:left to the left.

CSS float definition and usage

The Float property defines the direction in which the element floats. Historically, this property has always been applied to images, so that text surrounds the image, but in CSS, any element can float. A floating element generates a block-level box, regardless of its own element.

If floating non-replacement elements, specify a definite width; otherwise, they will be as narrow as possible.

float constant with attribute value left, right, none
Float:none do not use floating
Float:left floating on the left
Float:right floating on the right

The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.