简体   繁体   中英

IE9 doesn't work with span element

I have two snippets of code

.modal-body p {
    word-wrap: break-word;
    -ms-word-wrap: break-word;
}

div.clickable_edit span {
    word-wrap: break-word;
    -ms-word-wrap: break-word;
}

The first css rule successively breaks the words but second not. As I understood it's because IE9 doesn't work with span .

What is the walk-around to fix this problem? Should I rename span element to something else?

http://msdn.microsoft.com/en-us/library/ms531186%28VS.85%29.aspx

You need to make the span get "hasLayout". The p tag, being block level, has it already, but the span is just an inline element by default, and so it needs something extra:

An element has layout when it is absolutely positioned, is a block element, or is an inline element with a specified height or width.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM