Bootstrap div没有正确堆叠(Bootstrap divs not stacking right)
我有两个带
.container
类的div,它们没有正确堆叠。 相反,它们重叠。这是我的代码:
HTML
<div id="crossfadingImages" class="container"> <img src="./media/..." class="bottom img-responsive" alt="..."/> <img src="./media/..." class="top img-responsive" alt="..."/> </div> <div id="about" class="container"> <div class="row"> <div class="col-sm-6"> <p>about...</p> </div> <div class="col-sm-6"> </div> </div> </div>
CSS
#crossfadingImages{ position: relative; width: 100%; padding: 0; margin-top: 55px; } #crossfadingImages img{ position: absolute; left: 0; -webkit-transition: opacity 3s ease-in-out; -moz-transition: opacity 3s ease-in-out; -o-transition: opacity 3s ease-in-out; transition: opacity 3s ease-in-out; } #crossfadingImages img.top:hover{ opacity: 0; }
我认为问题是crossfadingImages div中图像的绝对位置。 请提供您的问题的解决方案以及解释。
I have two divs with
.container
class which are not stacking properly. Instead, they overlap.This is my code:
HTML
<div id="crossfadingImages" class="container"> <img src="./media/..." class="bottom img-responsive" alt="..."/> <img src="./media/..." class="top img-responsive" alt="..."/> </div> <div id="about" class="container"> <div class="row"> <div class="col-sm-6"> <p>about...</p> </div> <div class="col-sm-6"> </div> </div> </div>
CSS
#crossfadingImages{ position: relative; width: 100%; padding: 0; margin-top: 55px; } #crossfadingImages img{ position: absolute; left: 0; -webkit-transition: opacity 3s ease-in-out; -moz-transition: opacity 3s ease-in-out; -o-transition: opacity 3s ease-in-out; transition: opacity 3s ease-in-out; } #crossfadingImages img.top:hover{ opacity: 0; }
I think the problem is absolute position of images in crossfadingImages div. Please provide your solution to my problem as well as an explanation.
原文:https://stackoverflow.com/questions/38931360
最满意答案
当浏览器询问缓存的图像是否仍然有效时,您的php代码需要返回304 Not Modified标头。 在脚本顶部放置一个if语句,以便在再次发送映像之前处理该请求。
您总是发送图像,这就是浏览器显示200响应的原因。
Your php code needs to return the 304 Not Modified header when the browser asks if the cached image is still valid. Put an if statement at the top of your script to handle that request before sending the image again.
You are always sending the image that's why the browser is showing a 200 response.
相关问答
更多-
您可能希望使用private_no_expire而不是private ,但设置一个长期的内容,您知道将不会更改,并确保您处理if-modified-since和if-none-match请求类似于Emil的帖子。 $tsstring = gmdate('D, d M Y H:i:s ', $timestamp) . 'GMT'; $etag = $language . $timestamp; $if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SIN ...
-
如果您想要更完整的答案,则需要提供nginx配置。 按照这里找到的标准缓存设置应该可以解决问题。 如果您从/img/ always中提供文件,那么您可以执行以下操作: location ^~ /img/ { alias /absolute/path/to/img/folder; expires 31d; #or whatever you prefer add_header Vary Accept-Encoding; add_header Pragma public; ...
-
不,您不能直接依赖此图像,特别是如果您希望缓存通过应用程序启动等持续存在。您最好使用提供缓存选项和图像添加的网络框架: AFNetworking提供了方便的UIImageView添加(setImageURL:在UIImageView上,具有占位符支持等)。 MKNetworkKit No, you can't rely directly on this for images, especially if you want your cache to persist over app launches, et ...
-
如何在Phalcon中使用QueryBuilder和Paginator进行缓存?(How to Cache with QueryBuilder and Paginator in Phalcon?)[2022-05-03]
嗯......经过几个星期的思考xD ......我找到了一个很好的答案来解决我的问题。 首先,我们需要在Phalcon中拥有缓存服务: $di->set('dataCache', function() use ($config) { $lifetime = 60*60; // 1 hour if ($config->development) { $lifetime = 60; // 1 min } $frontCache = new \Phalcon\Ca ... -
当浏览器询问缓存的图像是否仍然有效时,您的php代码需要返回304 Not Modified标头。 在脚本顶部放置一个if语句,以便在再次发送映像之前处理该请求。 您总是发送图像,这就是浏览器显示200响应的原因。 Your php code needs to return the 304 Not Modified header when the browser asks if the cached image is still valid. Put an if statement at the top o ...
-
HTTP标头 - 缓存问题(HTTP Headers - Cache Question)[2023-11-28]
您同时拥有ETag和Last-Modified标头。 它可能会使用那些。 但为了实现这一点,它仍然需要分别使用If-None-Match或If-Modified-Since发出请求。 You have both an ETag and a Last-Modified header. It probably uses those. But for that to happen, it still needs to make a request with If-None-Match or If-Modified ... -
HTTP缓存标头(HTTP Cache Headers)[2021-05-09]
击败缓存的典型方法是附加搜索字符串(注意PNG后的问号): img.src = path +"/"+ name + ".png?" + (new Date().getTime()); 顺便说一下,你不需要做.toString(),因为将变量添加到一起的行为使它们成为一个字符串: "a" + 1 + 1; // "a11" The typical way to defeat the cache is to append a search string (note the question mark aft ... -
发送缓存标头。 $seconds_to_cache = 60 * 60 * 24; // 1 day header("Pragma: cache"); header("Cache-Control: max-age=" . $seconds_to_cache); 由于您的缓存机制似乎是指纹,您可以让浏览器永久缓存它。 Send caching headers. $seconds_to_cache = 60 * 60 * 24; // 1 day header("Pragma: cache"); header ...
-
更新图片后,在您访问的URL中添加一个额外的参数来显示图像,这里是`displayimage.php'。 最常见的是这是一个时间戳。 与正常情况一样,您可以访问displayimage.php?id=123123 更新配置文件pic后,要刷新图像,您需要访问displayimage.php?id=123123&time=1000121110 。 每当用户更新图像时,更改时间参数将强制从页面重新加载图像。 after they update the picture, add an extra paramete ...
-
Phalcon的图像资源(Image resources with Phalcon)[2022-01-23]
是的,我相信你的文件的位置是“改变”,我的意思是,当你访问Phalcon应用程序中的一个页面时,你所有的服务器端包含将把你的主引导文件的路径作为当前目录(主index.php文件路径),对于客户端,浏览器将始终认为执行的操作(如www.myapp.com/users/login-form/ )实际上是服务器上存在的目录结构(因此浏览器将尝试在www.myapp.com/users/login-form/bg.png加载您的背景。 这就是为什么Phalcon提供多种方式来提供html资产来解决这个问题,同时也 ...