CSS div width - only the width of the content ..?

I am trying to make my div be the width of my content, I can make it work in all other browsers except IE using:

div#quoteHolder {
  height: 85px;
  display: inline-block;
}

Does anyone know how to fix this in IE?

Oh and this is the html code.

<div id="quoteContainer">
  <div id="quoteHolder">
    <h2>"If you were lucky and lived in Port Melbourne, it might even be your local"</h2>
    <h3>The Age, Epicure. JUNE 22nd 2004</h3>
  </div>
</div>
+3
source share
3 answers

IE supports inline block, but only for elements that are internally inline. Thus, if you really want to use the built-in block, you are limited by ranges and strengths and ems when the list or paragraph may make more sense (and also degrade the quality for users without CSS).

, hasLayout ( hasLayout = true ) , : inline, IE! hack ( ), : IE .

, :

display:-moz-inline-stack;
display:inline-block;
zoom:1;
*display:inline;
+8

IE display, . : http://www.quirksmode.org/css/display.html. A float: left , , display: inline, height .

+3
div#quoteHolder {
  height: 85px;
  display: inline-block;
  border: #a9a9a9 1px solid;
  float: left;
}
+1
source

Source: https://habr.com/ru/post/1715594/


All Articles