Home >Web Front-end >HTML Tutorial >CSS centering can be centered as the browser becomes larger or smaller_html/css_WEB-ITnose

CSS centering can be centered as the browser becomes larger or smaller_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:44:071274browse

Key code:

Use of external DIV: text-align:center;

Use of internal DIV: margin-left:auto;margin-right:auto

Example:

<div style="text-align: center">    <div style="margin-left: auto;margin-right: auto;">        <fieldset>            <legend>居中</legend>        </fieldset>    </div></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