Why doesn't my div inside a span work properly?

前端 未结 7 1815
猫巷女王i
猫巷女王i 2020-12-18 23:46

I\'m writing the following HTML markup:

 Some Text
    
татата

and s

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-18 23:57

    Your markup is incorrect ( plus missing semi-colon as quoted by Steini, mentioning this for sake of completeness of answer )

    Answer 1 : span is an inline element, so having a div inside span is a bad idea, also, it would be better, if you nest span inside span and give inner span display:block property!

    Answer 2 : add display:block to span to change the default behavior

    working fiddle with correct markup

    fiddle with the layout you wanted

提交回复
热议问题