Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
784 views
in Technique[技术] by (71.8m points)

html - In IE11 using pseudo element ::before and display:table-cell and glyphicons contens wont show up

I've spent a rather good time on this now but cant come to a solution. My problem is that I want to display a glyphicon before the content of a text-block and that element with the icon has should fill up all the height that the body needs. This works in all browser versions except IE. I have boiled it down in this fiddle

<div class="block">
  <div class="body">BODY</div>
</div>

.body::before {
    background: blue;
    content: "e005";
    font-family: "Glyphicons Halflings";
    display: table-cell;
    width:30%;
}

.body {
    background-color: green;
    display: table;
    width: 25%;
}

If you add/remove the display: table-cell on the fiddle above using IE11 you will see where my problem is. Can someone give me a solution to this, or even better, explain what is happening.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There is an active bug report about this issue in Microsoft Connect website. On IE, font-family decleration is ignored in pseudo-element with display: table-cell; property.

To workaround this problem, you need to set display: inline-block;.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...