gpt4 book ai didi

css - 流体 div,一个带有要排列的图像?

转载 作者:行者123 更新时间:2023-11-28 12:59:18 26 4
gpt4 key购买 nike

我正在努力让这个布局稍微流畅一些。我希望#logo 位于#infobot 的右下角,其大小由我想随浏览器窗口缩放的图片决定。 #white 应该只是掩盖#logo 左侧的区域。如何让#white 和#logo 彼此相邻排列并仍然保持流体大小?HTML:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="description" content=""/>
<meta name="keywords"content=""/>
<title></title>
<link href="css/testmain.css" rel="stylesheet" type="text/css"/>
<link href='http://fonts.googleapis.com/css?family=EB+Garamond' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Volkhov' rel='stylesheet' type='text/css'>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>


<body>

<header>
<div id="nav">
<p><a href="#">+</a></p>
</div>
</header>
<div id="container">
<div id="infowrap">
<div style="background-color: white" id="infotop"></div>
<div style="background-color: yellow" class="infobox"></div>
<div style="background-color: blue" class="infobox"></div>
<div style="background-color: green" class="infobox"></div>
<div style="background-color: red" class="infobox"></div>
<div id="infobot">
<div id="white"></div>
<div id="logo"><img style="height: 100%" src="img/logo3.png"></div>
</div>
</div>
</div>




<script>
$('#video, #nav').on('click', function(){
$('#nav').toggleClass('rotate');
});
</script>




<script>
$(document).ready(function(){
$("#video, #nav").click(function(){
$("#infowrap").fadeToggle(250);
});
});
</script>




<video id="video" src="vid/147000037.mp4" autoplay loop>
</body>

</html>

CSS:

* {
margin: 0;
padding: 0;
}

body {
width: 100%;
height: 100%;
background-color: purple;
}

header {
position: relative;
display: block;
height: auto;
width: 100%;
z-index: 999;
min-width: 520px;
}

#nav {
-webkit-transition: all 0.5s;
position: absolute;
float: right;
display: block;
top: 5px;
right: 15px;
color: #000000;
}

#nav a {
font-family: "HelveticaNeue-UltraLight","HelveticaNeue-Light","Helvetica Neue",Helvetica,Arial,sans-serif;
text-decoration: none;
font-size: 2.5em;
color: #000000;
}

.rotate {
-webkit-transform: rotate(45deg);
-webkit-backface-visibility: hidden;
}

#video {
position: fixed;
top:0px;left:0px;right:0px;bottom:0px;
}

#container {
position: absolute;
width: 100%;
height: 100%;
min-width: 520px;
min-height: 620px;
}

#infowrap {
z-index: 900;
display: none;
position: absolute;
top:10px;left:10px;right:10px;bottom:10px;
background-color: ;
min-width: 500px;
}

#infotop {
width: 100%;
height: 6%;
min-width: 500px;
float: left;
clear: both;
display: block;
}

.infobox {
width: 50%;
height: 44%;
min-width: 250px;
min-height: 250px;
float: left;
display: block;
}

#infobot {
width: 100%;
height: 6%;
min-width: 500px;
float: left;
clear: both;
display: block;
}

#white {
height: 100%;
width:;
float: left;
display: block;
background-color: white;
}

#logo {

float: left;
display: block;

}

最佳答案

DEMO

CSS:

#infobot {
width: 100%;
height: 6%;
min-width: 500px;
float: left;
clear: both;
display: block;
background:#cf5; /* some bg color? */
}

#white {
height: 100%;
width:50%; /* !!! */
float: left;
display: block;
background-color: #fff;
}

顺便说一下,使用这个:

$(function(){
$("#video, #nav").click(function(){
$("#infowrap").fadeToggle(250);
$('#nav').toggleClass('rotate');
});
});

关于css - 流体 div,一个带有要排列的图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16279091/

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