得到一个iFrame并排的盒子
我的困境是,我想把盒子放在左边,把iframe和五个盒子并排放在右边,我不知道该怎么做。这是我的密码得到一个iFrame并排的盒子,iframe,Iframe,我的困境是,我想把盒子放在左边,把iframe和五个盒子并排放在右边,我不知道该怎么做。这是我的密码 <script> function clock() { setInterval( function(){ var d = new Date(); var h = d.getHours(); var m = d.getMinutes(); var s = d.getSeconds(); var box1 = document.getElementById("box1"); var bo
<script>
function clock()
{
setInterval(
function(){
var d = new Date();
var h = d.getHours();
var m = d.getMinutes();
var s = d.getSeconds();
var box1 = document.getElementById("box1");
var box2 = document.getElementById("box2");
var box3 = document.getElementById("box3");
var box4 = document.getElementById("box4");
var box5 = document.getElementById("box5");
switch(m % 10)
{
case 0:
box1.style.backgroundColor = "#34db00";
box2.style.backgroundColor = "#ffc000";
box3.style.backgroundColor = "#0093ff";
box4.style.backgroundColor = "#0093ff";
box5.style.backgroundColor = "#0093ff";
break;
case 1:
box1.style.backgroundColor = "#0093ff";
box2.style.backgroundColor = "#34db00";
box3.style.backgroundColor = "#ffc000";
box4.style.backgroundColor = "#0093ff";
box5.style.backgroundColor = "#0093ff";
break;
case 2:
box1.style.backgroundColor = "#0093ff";
box2.style.backgroundColor = "#0093ff";
box3.style.backgroundColor = "#34db00";
box4.style.backgroundColor = "#ffc000";
box5.style.backgroundColor = "#0093ff";
break;
case 3:
box1.style.backgroundColor = "#0093ff";
box2.style.backgroundColor = "#0093ff";
box3.style.backgroundColor = "#0093ff";
box4.style.backgroundColor = "#34db00";
box5.style.backgroundColor = "#ffc000";
break;
case 4:
box1.style.backgroundColor = "#ffc000";
box2.style.backgroundColor = "#0093ff";
box3.style.backgroundColor = "#0093ff";
box4.style.backgroundColor = "#0093ff";
box5.style.backgroundColor = "#34db00";
break;
case 5:
box1.style.backgroundColor = "#34db00";
box2.style.backgroundColor = "#ffc000";
box3.style.backgroundColor = "#0093ff";
box4.style.backgroundColor = "#0093ff";
box5.style.backgroundColor = "#0093ff";
break;
case 6:
box1.style.backgroundColor = "#0093ff";
box2.style.backgroundColor = "#34db00";
box3.style.backgroundColor = "#ffc000";
box4.style.backgroundColor = "#0093ff";
box5.style.backgroundColor = "#0093ff";
break;
case 7:
box1.style.backgroundColor = "#0093ff";
box2.style.backgroundColor = "#0093ff";
box3.style.backgroundColor = "#34db00";
box4.style.backgroundColor = "#ffc000";
box5.style.backgroundColor = "#0093ff";
break;
case 8:
box1.style.backgroundColor = "#0093ff";
box2.style.backgroundColor = "#0093ff";
box3.style.backgroundColor = "#0093ff";
box4.style.backgroundColor = "#34db00";
box5.style.backgroundColor = "#ffc000";
break;
case 9:
box1.style.backgroundColor = "#ffc000";
box2.style.backgroundColor = "#0093ff";
box3.style.backgroundColor = "#0093ff";
box4.style.backgroundColor = "#0093ff";
box5.style.backgroundColor = "#34db00";
break;
default:
box1.style.backgroundColor = "#0093ff";
box2.style.backgroundColor = "#0093ff";
box3.style.backgroundColor = "#0093ff";
box4.style.backgroundColor = "#0093ff";
box5.style.backgroundColor = "#0093ff";
}
}, 1000);
}
clock();
</script>
<style media="screen" type="text/css">
div
{
width:30%;
height:19.242%;
background-color:#0093ff;
border-radius:25px;
}
</style>
<div id="box1"></div>
<div id="box2"></div>
<div id="box3"></div>
<div id="box4"></div>
<div id="box5"></div>
<iframe src="https://www.google.co.uk/" name="iframe1" align="right" width="69%" height="600"></iframe>
功能时钟()
{
设定间隔(
函数(){
var d=新日期();
var h=d.getHours();
var m=d.getMinutes();
var s=d.getSeconds();
var box1=document.getElementById(“box1”);
var box2=document.getElementById(“box2”);
var box3=document.getElementById(“box3”);
var box4=document.getElementById(“box4”);
var box5=document.getElementById(“box5”);
开关(m%10)
{
案例0:
box1.style.backgroundColor=“#34db00”;
box2.style.backgroundColor=“#ffc000”;
框3.style.backgroundColor=“#0093ff”;
框4.style.backgroundColor=“#0093ff”;
框5.style.backgroundColor=“#0093ff”;
打破
案例1:
框1.style.backgroundColor=“#0093ff”;
box2.style.backgroundColor=“#34db00”;
box3.style.backgroundColor=“#ffc000”;
框4.style.backgroundColor=“#0093ff”;
框5.style.backgroundColor=“#0093ff”;
打破
案例2:
框1.style.backgroundColor=“#0093ff”;
框2.style.backgroundColor=“#0093ff”;
box3.style.backgroundColor=“#34db00”;
框4.style.backgroundColor=“#ffc000”;
框5.style.backgroundColor=“#0093ff”;
打破
案例3:
框1.style.backgroundColor=“#0093ff”;
框2.style.backgroundColor=“#0093ff”;
框3.style.backgroundColor=“#0093ff”;
box4.style.backgroundColor=“#34db00”;
box5.style.backgroundColor=“#ffc000”;
打破
案例4:
box1.style.backgroundColor=“#ffc000”;
框2.style.backgroundColor=“#0093ff”;
框3.style.backgroundColor=“#0093ff”;
框4.style.backgroundColor=“#0093ff”;
box5.style.backgroundColor=“#34db00”;
打破
案例5:
box1.style.backgroundColor=“#34db00”;
box2.style.backgroundColor=“#ffc000”;
框3.style.backgroundColor=“#0093ff”;
框4.style.backgroundColor=“#0093ff”;
框5.style.backgroundColor=“#0093ff”;
打破
案例6:
框1.style.backgroundColor=“#0093ff”;
box2.style.backgroundColor=“#34db00”;
box3.style.backgroundColor=“#ffc000”;
框4.style.backgroundColor=“#0093ff”;
框5.style.backgroundColor=“#0093ff”;
打破
案例7:
框1.style.backgroundColor=“#0093ff”;
框2.style.backgroundColor=“#0093ff”;
box3.style.backgroundColor=“#34db00”;
框4.style.backgroundColor=“#ffc000”;
框5.style.backgroundColor=“#0093ff”;
打破
案例8:
框1.style.backgroundColor=“#0093ff”;
框2.style.backgroundColor=“#0093ff”;
框3.style.backgroundColor=“#0093ff”;
box4.style.backgroundColor=“#34db00”;
box5.style.backgroundColor=“#ffc000”;
打破
案例9:
box1.style.backgroundColor=“#ffc000”;
框2.style.backgroundColor=“#0093ff”;
框3.style.backgroundColor=“#0093ff”;
框4.style.backgroundColor=“#0093ff”;
box5.style.backgroundColor=“#34db00”;
打破
违约:
框1.style.backgroundColor=“#0093ff”;
框2.style.backgroundColor=“#0093ff”;
框3.style.backgroundColor=“#0093ff”;
框4.style.backgroundColor=“#0093ff”;
框5.style.backgroundColor=“#0093ff”;
}
}, 1000);
}
时钟();
div
{
宽度:30%;
身高:19.242%;
背景色:#0093ff;
边界半径:25px;
}
这将显示为所需的左侧下方的5个框,但是iframe位于下方和右侧,而不是右侧框的侧面。我怎样才能让他们肩并肩?谢谢。您学习了CSS的基础知识吗?您只需将
iframe{float:right;}
添加到样式表中,然后将iframe放在HTML中div的上方。顺便说一句,我在这里看到了我的解决方案,但并没有接受它作为一个答案。啊哈,天哪,我真的不知道为什么我没有想到。非常感谢@dljve