2015-03-31 85 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

相关问题