HTML span align center not working?

前端 未结 7 1514
别跟我提以往
别跟我提以往 2020-12-22 22:36

I have some HTML:

This is some text in a div element!

The Div is c

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-22 22:56

    A div is a block element, and will span the width of the container unless a width is set. A span is an inline element, and will have the width of the text inside it. Currently, you are trying to set align as a CSS property. Align is an attribute.

    
        This is some text in a div element!
    
    

    However, the align attribute is deprecated. You should use the CSS text-align property on the container.

    This is some text in a div element!

提交回复
热议问题