Home >Web Front-end >HTML Tutorial >Help: Why can't the second label I set with css be centered_html/css_WEB-ITnose

Help: Why can't the second label I set with css be centered_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:22:271088browse

CSS tag source code

There is no problem with the p tag, but the b tag cannot be centered. What is the problem? The source code for solving
is as follows:


p {
color:blue;
font-size:4cm;
background-color:red;
border:2px solid blue;
text-align:center;

}

b
{
color:blue;
font-size:7cm;
background-color:red;
border:3px solid blue ;
text -align:center;

}

b>aaaaa



Reply to discussion (solution)

The B tag cannot be centered, it can only change the font style. Similar to this are FONT, I, STONG, etc., as well as SPAN. If you really want it to be centered, add a display:block;. Only then can he be centered.
Thanks, got it

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