gpt4 book ai didi

html - 可调整大小图像上的工具提示位置

转载 作者:行者123 更新时间:2023-11-28 06:51:02 25 4
gpt4 key购买 nike

首先,我不是 html/ccs 编码方面的专家。我想使用来自(见下文)http://codepen.io/ianfarb/pen/qkpJH 的代码片段但在此示例中,工具提示的图像和位置是固定的。就我而言,我希望在调整浏览器宽度大小时调整图像大小。此外,工具提示必须保持在正确的位置。有什么建议么?

@import url(http://fonts.googleapis.com/css?family=Roboto:100,400);

* { margin:0; padding:0;}

body { background:url(http://img.tapatalk.com/d/12/10/31/6yby7usy.jpg) center center;
}

#container { background:url(https://lh3.ggpht.com/PQXITv6h0hTZLqlvlni7RSN2rE70QytYeNAtngBc3wKQuq8g5gH28EUDqYKgCPkWfQ=h900-rw) no-repeat;
background-size:500px 293px;
width:500px;
height:293px;
margin:25px auto;}

.tooltip { width:16px;
height:16px;
border-radius:10px;
border:2px solid #fff;
position:absolute;
background:rgba(255,255,255,.5);}


.tooltip:hover
{ -webkit-animation-play-state: paused;}

.tooltip:hover .info {visibility:visible;}

#first { margin: 200px 0 0 200px !important;}

#second { margin:75px 0 0 52px !important;}

#third { margin:158px 0 0 425px !important;}

.info { width:200px;
padding:10px;
background:rgba(255,255,255,1);
border-radius:3px;
position:absolute;
visibility:hidden;
margin:-105px 0 0 -100px;
box-shadow:0 0 50px 0 rgba(0,0,0,.5);}

h3 { font-family: 'Roboto', sans-serif;
font-weight:100;
font-size:20px;
margin:0 0 5px 0;}

p { font-family: 'Roboto', sans-serif;
font-weight:400;
font-size:12px;}

.arrow {
position:absolute;
margin:10px 0 0 88px;
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid #fff;
}
<div id="container">
<div class="tooltip" id="first">
<div class="info">
<h3>Awesome Display</h3>
<p>The world's highest-resolution 7" tablet puts over 2.3 million pixels in the palm of your hand. </p>
<div class="arrow"></div>
</div>
</div>

<div class="tooltip" id="second">
<div class="info">
<h3>Stay Connected</h3>
<p>Hangout and share your world with those that matter the most to you in glorious high definition. </p>
<div class="arrow"></div>
</div>
</div>

<div class="tooltip" id="third">
<div class="info">
<h3>Powerful Portability</h3>
<p>Delivering the game and applications that help you have more fun and get more done. </p>
<div class="arrow"></div>
</div>
</div>

</div>

最佳答案

为此,您需要更改一些内容(见下文):

对背景图像进行少量更改以使其响应:

#container {
background: url(https://lh3.ggpht.com/PQXITv6h0hTZLqlvlni7RSN2rE70QytYeNAtngBc3wKQuq8g5gH28EUDqYKgCPkWfQ=h900-rw) no-repeat;
background-repeat: no-repeat;
background-size: contain;
background-position: center;
height: 400px;
margin: 25px auto;
width: 600px;
position: relative;
max-width: 100%;
}

指定每个点的位置:

#first   { 
left: 5%;
top: 95px;
}

#second {
left: 40%;
top: 235px;
}

#third {
left: 90%;
top: 135px;
}

关于html - 可调整大小图像上的工具提示位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33768770/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com