Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the alignment of two ends in css

Shulou Source: shulou.com Published: 2022-06-02 04:44:53 10月02日 Update

This article mainly shows you "how to achieve alignment at both ends in css". the content is simple and easy to understand and the organization is clear. i hope it can help you solve your doubts. let Xiaobian lead you to study and learn this article "how to achieve alignment at both ends in css".

In css, the code for setting two-paragraph alignment is "element {text-align:justify;}"; the "text-align" attribute is used to set the horizontal alignment of the specified element text. When the attribute value is set to justify, the element will be aligned horizontally.

Operating environment of this tutorial: Windows 10 system, CSS3 && HTML5 version, Dell G3 computer.

The text-align attribute specifies the horizontal alignment of the element text.

Attribute values are as follows:

Left Line the text to the left. Default value: determined by browser.

Right Line the text to the right.

Center arranges text in the middle.

Justify achieves the effect of aligning text at both ends.

inherit specifies that the value of the text-align attribute should be inherited from the parent element.

The syntax is as follows:

Element {text-align:justify;}

Examples are as follows:

123 p{ text-align:justify; } p i{ display:inline-block; width:100%; }

Justified text

Output:

The above is "how to achieve alignment at both ends in css" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Tags: Text elements both ends attributes content level article way learning help code right effects tutorials directions easy to understand more organization browser environment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Microsoft OPPO Reno NVidia Xiaomi