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
Release: 2016-06-24 12:07:36
Original
2470 people have browsed it

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


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>
Copy after login

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>
Copy after login

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template