2016-03-27 50 views
0

我在這裏有點複雜的情況(至少對我來說很複雜)。附上小提琴,以顯示我是如何努力完成這一點。所有分辨率下的位置圖像都相似

我想將講話泡泡放在黃色圖像黑線的中央。 (在小提琴中顯示)。

另外,當我走到較小的設備時,文本會在對話框下面流動。 (你可以重新調整窗口大小並看看)

所有這些都必須顯示在100 vh高度的含義,用戶不需要滾動查看氣泡以及圖像。

Fiddle Link to show what I was doing

<div class="container" id="about_container"> 
    <div class="row" id="row_about_1"> 
     <div class="col-lg-2 col-md-2 col-xs-2 col-sm-2"></div> 

     <div class="col-lg-8 col-md-8 col-xs-8 col-sm-8 bubble"> 

      <div class="abt_txtcontainer"> 
       <p class="abt_maintext">Heading</p> 
       <p class="abt_subtxt">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s 
       </p> 

       <p class="abt_maintext">Heading</p> 
       <p class="abt_subtxt">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s 
       </p> 


       <p class="abt_maintext">Heading</p> 
       <p class="abt_subtxt">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s 
       </p> 
      </div> 
     </div> 

     <div class="col-lg-2 col-md-2 col-xs-2 col-sm-2"></div> 
    </div> 

    <div class="row" id="row_about_2"> 
     <div class="col-lg-2"></div> 
     <div class="col-lg-8"> 
      <img src="http://i.imgur.com/5T5N5Vn.png" class="about_bg img-responsive"> 
     </div> 
     <div class="col-lg-2"></div> 

    </div> 


</div> 
+0

我看到泡沫在屏幕的中央你是什麼意思黃色image'的黑線的中心' ? – Pedram

回答

0

嘗試此代碼:

.bubble { 
 
    position: relative; 
 
    z-index: 1; 
 
    /*width: 80%;*/ 
 
    height: auto; 
 
    /* margin-left:12.5%;*/ 
 
    padding: 5%; 
 
    background: #2e3c6f; 
 
    -webkit-border-radius: 15px; 
 
    -moz-border-radius: 15px; 
 
    border-radius: 15px; 
 
    color:darkgrey; 
 
} 
 

 
.bubble:after { 
 
    content: ''; 
 
    position: absolute; 
 
    border-style: solid; 
 
    border-width: 32px 21px 0; 
 
    border-color: #2e3c6f transparent; 
 
    display: block; 
 
    width: 0; 
 
    z-index: 1; 
 
    margin-left: -10.5px; 
 
    bottom: -32px; 
 
    left: 50%; 
 
} 
 

 
.about_bg { 
 
    width: 100%; 
 
    height: auto; 
 
} 
 

 
#about_container { 
 
    height: 100vh; 
 
    margin-top: 2.5%; 
 
} 
 

 
#row_about_1 { 
 
    height: 80vh; 
 
} 
 

 
#row_about_2 { 
 
    height: 20vh; 
 
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/> 
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> 
 

 
<div class="container" id="about_container"> 
 
    <div class="row" id="row_about_1"> 
 
    <div class="col-lg-2 col-md-2 col-xs-2 col-sm-2"></div> 
 

 
    <div class="col-lg-8 col-md-8 col-xs-8 col-sm-8 bubble"> 
 

 
     <div class="abt_txtcontainer"> 
 
     <p class="abt_maintext">Heading</p> 
 
     <p class="abt_subtxt">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s 
 
     </p> 
 

 
     <p class="abt_maintext">Heading</p> 
 
     <p class="abt_subtxt">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s 
 
     </p> 
 

 

 
     <p class="abt_maintext">Heading</p> 
 
     <p class="abt_subtxt">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s 
 
     </p> 
 
     </div> 
 
    </div> 
 

 
    <div class="col-lg-2 col-md-2 col-xs-2 col-sm-2"></div> 
 
    </div> 
 

 
    <div class="row" id="row_about_2"> 
 
    <div class="col-lg-2"></div> 
 
    <div class="col-lg-8"> 
 
     <img src="http://i.imgur.com/5T5N5Vn.png" class="about_bg img-responsive"> 
 
    </div> 
 
    <div class="col-lg-2"></div> 
 

 
    </div> 
 

 

 
</div>

解決方案:

1)要設置氣泡箭頭中心: - >添加位置ABSOL ute和左值50%,然後增加餘量10.5%(這是箭頭的半寬度)

2)重疊內容: - >設置氣泡高度自動(以前是80%),現在當你將調整瀏覽器大小不會受到干擾。

+0

謝謝。我從你的代碼中獲得了幫助,添加了一些我的代碼並修復了這個問題。 :) –

0

您可能需要更流暢的解決方案,但通過媒體查詢,您可以在較大的屏幕上從底部調整圖像大小和位置氣泡。只需添加一個步驟,例如。在屏幕上> 1200px。 爲了避免溢出我會保持容器的最小高度...

.about-container { 
 
\t height: 100vh; 
 
\t min-height: 580px; 
 
} 
 

 
.about-container .wrap { 
 
\t position: relative; 
 
\t height: 100%; 
 
} 
 

 
.bubble { 
 
\t background: #2e3c6f; 
 
\t color: #fff; 
 
\t position: absolute !important; 
 
\t bottom: 150px; 
 
\t left: 0; 
 
\t padding: 30px; 
 
\t border-radius: 15px; 
 
\t z-index: 1; 
 
} 
 

 
.bubble:after { 
 
\t position: absolute; 
 
\t content: ''; 
 
\t top: 100%; 
 
\t left: 50%; 
 
\t height: 0; 
 
\t width: 0; 
 
\t border: solid transparent; 
 
\t border-top-color: #2e3c6f; 
 
\t border-width: 30px; 
 
\t margin-left: -30px; 
 
} 
 

 
p:last-child { 
 
\t margin-bottom: 0; 
 
} 
 

 
.about-img { 
 
\t position: absolute; 
 
\t bottom: 0; 
 
\t left: 0; 
 
\t right: 0; 
 
\t margin: 0 auto; 
 
\t max-width: 320px; 
 
\t height: auto; 
 
}
<html> 
 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> 
 
    <body> 
 
    <div class="container about-container"> 
 
     <div class="wrap"> 
 
     <div class="col-xs-12 col-md-8 col-md-offset-2 bubble"> 
 
      <p>Heading</p> 
 
      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s </p> 
 
      <p>Heading</p> 
 
      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s</p> 
 
      <p>Heading</p> 
 
      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s </p> 
 
     </div> 
 
     <img src="http://i.imgur.com/5T5N5Vn.png" class="about-img"> 
 
     </div> 
 
    </div> 
 
    </body> 
 
</html>

+0

謝謝隊友。我使用了Vinaya下面的代碼,並在其上做了一些Mod來達到我的目的。順便說一句,是的,我不得不使用大量的媒體查詢。 –