search

Home  >  Q&A  >  body text

Why does the span element have width and height attributes after setting float in css?

Why does the span element have width and height attributes after setting float in css?

P粉301974093P粉301974093640 days ago2054

reply all(3)I'll reply

  • WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB

    WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB2023-06-29 11:11:42

    For the span element, it is an inline element and does not have width and height attributes by default. But when the span element is set to float, it will become a floating box of a block-level element. At this time, its width will be adjusted according to the width of the content, and the content will expand the height of the element. Therefore, the span element that is floated will have width and height attributes.

    reply
    0
  • 李栋

    Master, can you add us on WeChat to ask questions about GraphQL?

    李栋 · 2023-09-05 21:00:47
    李栋

    Master, can you add WeChat to ask questions about GraphQL? V: dongli3023

    李栋 · 2023-09-05 21:01:10
  • Cancelreply