首页 \ 问答 \ Bootstrap div没有正确堆叠(Bootstrap divs not stacking right)

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
更新时间:2022-10-27 19:10

最满意答案

当浏览器询问缓存的图像是否仍然有效时,您的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 ...
  • 嗯......经过几个星期的思考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 ...
  • 您同时拥有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 ...
  • 击败缓存的典型方法是附加搜索字符串(注意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应用程序中的一个页面时,你所有的服务器端包含将把你的主引导文件的路径作为当前目录(主index.php文件路径),对于客户端,浏览器将始终认为执行的操作(如www.myapp.com/users/login-form/ )实际上是服务器上存在的目录结构(因此浏览器将尝试在www.myapp.com/users/login-form/bg.png加载您的背景。 这就是为什么Phalcon提供多种方式来提供html资产来解决这个问题,同时也 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)