javascript - 如何忽略浏览器窗口的大小?
问题描述
我希望网站上的对象在浏览器大小发生变化时不会移出。
我怎么解决这个问题?
这是一个正在移出的对象的代码
div[class=ygol4] {
border-radius: 200px;
border: 3px solid #ffffff;
width: 15px;
height: 15px;
background: #151515;
position: fixed;
top: 86.3%;
left: 36%;
margin-right: -50%;
transform: translate(-50%, -50%);
z-index: 3;
}
解决方案
#container{
width:960px;
margin:0px auto;
}
#container img{
width:960px;
}
#left-column{
width:700px;
float:left;
background:lightblue;
}
#right-column{
width:260px;
float:left;
background:gold;
}
@media screen and (max-width:959px){
#container{
width:100%;
}
#container img{
width:100%;
}
#left-column{
width:70%;
}
#right-column{
width:30%;
}
}
@media screen and (max-width:640px){
#left-column{
width:100%;
}
#right-column{
width:100%;
}
@media screen and (max-width:320px){
#container{
width:320px;
}
}
<div id="container">
<img
src="https://unsplash.com/photos/osPrIcTwJy4"/>
<section id="left-column">
this is the left column
</section>
<aside id="right-column">
this is the right column
</aside>
</div>
这是我经历过的最烦人的搜索之一,但尝试遵循这种格式,它帮助了我并节省了我很多时间。要了解该方法的概念,请查看此 YouTube 视频https://youtu.be/fA1NW-T1QXc
推荐阅读
- bash - 如何使用 Bash 自动化两个 os.Stdin 输入
- javascript - 在 gremlin 中,如何查找和排序给定顶点所属的所有连接顶点的三元组?
- javascript - 如何在 AngularJs 中清除输入文件 img base64?
- python - Django 从数组生成模型字段
- ios - 根据 Key 减少并获取包含自定义对象的 Dictionary 的总和
- jquery - 数据表:从现有 JSON 对象设置行 HTML5 数据-* 属性
- nuget-package - DbContext 在包管理器控制台中不起作用
- c# - C# - OpenOfficeXML 日期格式
- python - 如何迭代具有两个变量的 xpath?
- c# - Xamarin 长时间运行的后台任务