如何做响应式悬停?
这是一个很好的悬停示例,它非常适合我的屏幕尺寸,这很糟糕,没有响应的悬停示例
HTML
<div class="product-img-list">
<%= link_to product_path(product), class: 'product_link' do %>
<%= image_tag(product.image_url, class: "img-responsive", size: "300x250") %>
<% end %>
<span class="product-img-text"><span>code</span></span>
</div>
CSS
span.product-img-text {
background: rgba(0,0,0,0.5);
color: white;
cursor: pointer;
display: table;
height: 80px;
left: 15px;
position: absolute;
top: 230px;
width: 291px;
opacity: 0;
-webkit-transition: opacity 500ms;
-moz-transition: opacity 500ms;
-o-transition: opacity 500ms;
transition: opacity 500ms;
}
.product-img-list:hover span.product-img-text {
opacity: 1;
}
span.product-img-text span {
display: table-cell;
text-align: center;
vertical-align: middle;
}
.img-responsive {
list-style-type: none;
margin: 0;
padding: 0;
text-align: center;
}
.product-img-list.img-responsive {
display: inline-block;
margin: 0 1em 1em 0;
position: relative;
}
感谢您的帮助
答案 0 :(得分:0)
我想说你必须让 int roomIs = 0;
Console.WriteLine("Hello World. Type /Help for help or /Play to play!");
roomIs = 1;
var Enter = default(string);
do
{
Enter = Console.ReadLine();
switch (Enter)
{
case ("/Help"):
Console.Clear();
Console.WriteLine("Welcome to the help room, type /Return to return to your last room!");
break;
case ("/Return"):
if (roomIs == 1)
{
Console.Clear();
Console.WriteLine("Hello World. Type /Help for help or /Play to play!");
}
break;
}
}
while (!string.IsNullOrEmpty(Enter));
做出回应(而不是使用硬编码维度)
类似于以下内容
.product-img-text
如果不是span.product-img-text {
background: rgba(0,0,0,0.5);
color: white;
cursor: pointer;
display: table;
position: absolute;
height: 25%; /*assuming text is not that much*/
left: 1em; /*to account for margin*/
right:1em /*to account for margin*/
bottom: 0; /*add it to bottom of image*/
opacity: 0;
-webkit-transition: opacity 500ms;
-moz-transition: opacity 500ms;
-o-transition: opacity 500ms;
transition: opacity 500ms;
}
,则必须将其.product-img-list
定位。
realtive