Home > Article > Web Front-end > CSS centering can be centered as the browser becomes larger or smaller_html/css_WEB-ITnose
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>