- Web design
- CSS
- here
text-align --Left-justified, center-justified, right-justified text --Introduction to CSS [CSS3 compatible]
Set text-align in the stylesheet (CSS) to align the text left, center, and right.
Left justified
Centered
Right justified
<div style = "text-align: left; background: #eef;"> Left justified </div> <br> <div style = "text-align: center; background: #eef;"> Centered </div> <br> <div style = "text-align: right; background: #eef;"> Right justified </div>
Elements left-justified, center-justified, right-justified
If the element is an inline element or an inline block element, you can use text-align to left-justify, center-justify, and right-justify.
Inline element-img tag
The img tag, which is an inline element, can be left-aligned, center-aligned, and right-aligned with text-align .
<div style = "text-align: center; background: #eef;"> <img src = "/ images / webdesign-logo.png"> </div>
Inline block element --button tag
The button tag, which is an inline block element, can be left-aligned, center-aligned, and right-aligned with text-align .
<div style = "text-align: center; background: #eef;"> <button> button </button> </div>