2017-04-10 6 views
2

私は本当にこれを行う方法を知っていると思っていました。これについては、私はちょっとばかばかしい単純なケースに一致する答えを見ていない。右の閉じるボタンの周りを流れる左のdivのテキストを取得する方法(IE8でも動作するように!)

#examined-evidence { 
    z-index: 1000; 
    display: none; 
    position: absolute; 
    left: 25%; 
    top: 10%; 
    width: 50%; 
    height: 80%;  
    background-image: url('../assets/images/transparent_grey_tint.png'); 
    border: 1px solid #33ffff; 
    padding: 0px; 
    margin: 0px; 
} 

#examined-evidence.active { 
    display: inline-block; 
} 

#examined-evidence #examined-evidence-details { 
    background-color: #333333; 
} 

#examined-evidence #examined-evidence-details .heading { 
    padding: 0px; 
    float: left; 
    display: inline-block; 
} 

#examined-evidence #examined-evidence-details .heading p { 
    text-align: center; 
    padding: 3px 12px 3px 12px; 
    display: inline-block; 
    font-size: 0.75em; 
    color: white; 
    margin: 0px; 
} 

#examined-evidence #examined-evidence-image { 
    text-align: center; 
    margin: 0px auto; 
    height: 80%; 
    width: auto;  
} 

#examined-evidence #examined-evidence-image img { 
    height: 80%; 
} 

#examined-evidence-close-button { 
    background-color: red; 
    display: inline-block; 
    float: right; 
    height: 34px; 
    width: 34px; 
    margin: 0px; 
    padding: 0px; 
} 
.clear { 
    clear: both; 
} 

...しかし、ブロックをインライン化するほとんどすべてを設定するにもかかわらず、閉じるボタンのdivがまだ、テキストのdiv BELOW表示されます。

<div id="examined-evidence"> 
    <div id="examined-evidence-details"> 
     <div class="heading"><p>I would like this text to float left and, if necessary, flow AROUND the close button which, ideally, would stay put in the top right corner, where most reasonable people would expect a close button to sit. Surely this should be more straight forward.</p></div> 
     <div id="examined-evidence-close-button" class="button"></div> 
     <div class="clear"></div> 
    </div> 
</div> 

そして、ここでは、CSSです:ここでは
は、HTMLですIEとChromeで (ちょっと参考に、img srcはjavascriptから設定されていますので、心配しないでください)

誰かがアイデアを持っているなら、私はこのウェブページを誰かに見せたくありません。今回私は何が壊れましたか?

+0

が、私は、これに答えることは、左に浮動するDiv(クラス=見出し)の前に右(閉じボタン)*フロートするDivを置くことであることを思い出しているようです。 これは、デフォルトではインラインブロックである入力ボタンで確実に機能します。 –

+0

divでテキストの幅を設定する必要があります。そうでない場合はデフォルトで100%になり、ボタンdivがその下に押し込まれます。 –

答えて

0

あなたの余白を調整し、p要素内のインラインスパンにあなたの閉じるボタンを削除して、あなたはすべてのセットする必要があります:私はIE <9を使用して停止しました

 #examined-evidence { 
 
     z-index: 1000; 
 
     position: absolute; 
 
     left: 25%; 
 
     top: 10%; 
 
     width: 50%; 
 
     height: 80%; 
 
     background: dimGray; 
 
     border: 1px solid #33ffff; 
 
     padding: 0px; 
 
     margin: 0px; 
 
     } 
 

 
     #examined-evidence.active { 
 
     display: inline-block; 
 
     } 
 

 
     #examined-evidence #examined-evidence-details { 
 
     background-color: #333333; 
 
     } 
 

 
     #examined-evidence #examined-evidence-details .heading { 
 
     padding: 0px; 
 
     float: left; 
 
     display: inline-block; 
 
     } 
 

 
     #examined-evidence #examined-evidence-details .heading p { 
 
     text-align: justify; 
 
     padding: 3px 12px 3px 12px; 
 
     display: inline-block; 
 
     font-size: 0.75em; 
 
     position: relative; 
 
     width: 100%; 
 
     color: white; 
 
     margin: 0px; 
 
     } 
 

 
     #examined-evidence #examined-evidence-image { 
 
     text-align: center; 
 
     margin: 0px auto; 
 
     height: 80%; 
 
     width: auto; 
 
     } 
 

 
     #examined-evidence #examined-evidence-image img { 
 
     height: 80%; 
 
     } 
 

 
     #examined-evidence-close-button { 
 
     background-color: red; 
 
     display: inline-block; 
 
     float: right; 
 
     height: 34px; 
 
     width: 34px; 
 
     padding: 0px; 
 
     position: relative; 
 
     margin: 0px 15px 10px 10px; 
 
     } 
 
     .clear { 
 
     clear: both; 
 
     }
<div id="examined-evidence"> 
 
     <div id="examined-evidence-details"> 
 
      <div class="heading"><p><span id="examined-evidence-close-button" class="button"></span>I would like this text to float left and, if necessary, flow AROUND the close button which, ideally, would stay put in the top right corner, where most reasonable people would expect a close button to sit. Surely this should be more straight forward.I would like this text to float left and, if necessary, flow AROUND the close button which, ideally, would stay put in the top right corner, where most reasonable people would expect a close button to sit. Surely this should be more straight forward.I would like this text to float left and, if necessary, flow AROUND the close button which, ideally, would stay put in the top right corner, where most reasonable people would expect a close button to sit. Surely this should be more straight forward.</p></div> 
 
      <div class="clear"></div> 
 
     </div> 
 
    </div>

+0

こんにちは@MadGabと答えに感謝します。これは有望ですが、唯一の(言及されていない)問題は、p要素のhtml()をjQueryで設定し、クローズボタンスパンを上書きして、事前初期化された角度のクリックを削除することです。私はスパンに影響を与えずにpの内容を置き換える方法を考えようとしています。 – moosefetcher

+0

$ compileサービスで動作させることができるはずです。ここに例がありますが、コントローラからDOMを操作しないように注意してください。デモ用:https://jsfiddle.net/8g6Lrsyu/。 – Mark

+0

@moosefetcherさんはこれを手に入れることができましたか? – Mark

関連する問題