Why can't I use the p tag to set the center?_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:14:14
Original
2195 people have browsed it



>



The #page I set {width:500px;height:30px;margin:0 auto;}
In IE it is centered, but in Firefox it is not centered ,
Later, I changed

to

or
    and it became centered. I don’t know why?

    is also a block element,



    Reply to the discussion (solution)
    For p, use


    You can use firebug to track it under ff, and the generated document The tree has changed

     text-align : center
    Copy after login


    p can only contain inline elements, not block elements

    <p id="page">   <form>       <input type="text" name="text">   </form></p>被解析成为 以下文档树了,自然不起作用了<p id="page"></p>     <form>      <input name="text" type="text">    </form><p></p>
    Copy after login
    There are rules for nesting elements, not how you want to nest them

    The DOCTYPE definition is missing

    Thanks to 2nd floor, I understand

    o, bd

    Try not to use blocks in P tags!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!