2015-03-31 80 views
-1

你好我的網頁上有2個字符圖像,我已經放在文字和橫幅的兩側,繼承人的圖片http://i.imgur.com/KwzphQP.jpg但是繼承人的問題,當我rezise我的瀏覽器的圖像跟隨瀏覽器,他們做不能留在同一個位置,我不希望這種情況發生,因爲我有一個固定的佈局,繼承人的CSS代碼,我不知道如何將它張貼好,但無論如何如何在瀏覽器調整大小時保留圖像?

.support-text { 
    width: 600px; 
    margin-left: auto; 
    margin-right: auto; 
    line-height: -2px; 
    margin-bottom: 130px; 

} 

.support-text h1 { 
    font-size: 30px; 
} 

.support-text { 
    clear: left; 
} 

.support-text { 
    font-size: 23px; 
} 

.support-img { 
    margin-top: -80px; 
    margin-bottom: 80px; 
    z-index: 1; 
} 

.ct-pic { 
    position: absolute; 
    right: 10px; 
    bottom: 30px; 
    float: right; 
} 

.ct-pic:hover { 
    -webkit-filter: brightness(180%); 
} 

.t-pic:hover { 
    -webkit-filter: brightness(180%); 
} 

.t-pic { 
    position: absolute; 
    left: 40px; 
    bottom: 30px; 
    float: left; 
} 

繼承人的HTML

<section class="support-text"> 
      <div class="ct-pic"> </div> 
    <div class="t-pic" width="867" height="569"></div> 
     <img src="img/support-us.png" class="support-img"> 
     <p>Hello, if this site has helped you improve your gameplay, and learn useful stuff, feel free to support us, so we can keep this website up, so more people can learn. You can support through Steam or throught paypal. Keep in mind that you do not have to support, but if you do, we appreciate it alot. and we can continue to upload new content (Smokes, flashes, tactics) to the website. </p> 

    </section> 
+0

你需要包括你的html以及任何javascript。 – 2015-03-31 19:27:53

+0

不使用圖像'',使用'div'作爲圖像鏈接,並給它一個固定的寬度 – 2015-03-31 19:28:01

+0

我們需要看到html,但是你不能漂浮**和**絕對定位......選擇一個或另一個。 – 2015-03-31 19:28:11

回答

1

繼承人如何將事物彼此相鄰放置而不移動或改變位置的示例當你調整窗口大小(divs可以是img標籤或任何你想要的)。只要把它們放在一個「容器」有一個固定的寬度,然後把它們飄浮該容器中的

<div id='container'> 
    <div id='image-1' class='image'></div> 
    <div id='image-2' class='image'></div> 
    <div id='image-3' class='image'></div> 
</div> 

#container { 
    width: 200px; 
    height: 100px; 
    background: black; 
} 
.image { 
    background: white; 
    width: 20px; 
    height: 20px; 
    float: left; 
    margin: 20px; 
} 

http://jsfiddle.net/7qytj718/1/

更新

你有一個問題,你的CSS。您將子元素的位置設置爲絕對位置,這會讓他們忽略其父元素並相對於整個窗口進行定位。發生這種情況時,窗口大小調整時,子元素開始移動。

+0

我有他們在一個固定的容器內與 – erdrag 2015-03-31 19:49:12

+0

你的問題是你的孩子divs有一個位置:絕對'這使得他們相對於窗口的位置,而不是他們的父div。你需要刪除'position:absolute',並使用浮動或使用'position:relative' – 2015-04-01 00:00:28

相關問題