Home >Web Front-end >HTML Tutorial >How to center two lines of text in the same row_html/css_WEB-ITnose

How to center two lines of text in the same row_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:07:362470browse

<div>	11111111111111111111111111111111111111<span><h2 style="text-align:center;">222</h2></span></div>


I want 111111111111111111111111 to the left, 222 in the middle, on the same line, now it is 2 lines


Reply to the discussion (solved Solution)


<div>    <span style="float:left;">11111111111111111111111111111111111111</span><h2 style="margin:0 auto;width:200px;text-align:center;">222</h2></div>

Set h1{display:inline;} to be on the same line; then add a few   to open up the position

Try this, I changed the width to 100%, so that 222 is centered on any screen

<div>    <span style="float:left;">11111111111111111111111111111111111111</span><h2 style="margin:0 auto;width:100%;text-align:center;">222</h2></div>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn