【发布时间】:2016-01-25 17:43:18
【问题描述】:
我正在制作一个网站,但是当我想让边框透明以从 div 中“减去”它时,它不起作用。谁能告诉我发生了什么以及我该如何解决这个问题?另外,当我放大边界时,边界会变大,但其余的却不会,有人能告诉我一个解决办法吗? 这是代码:
<!DOCTYPE html>
<html>
<head>
<title> Homepagina </title>
<link rel="stylesheet" type="text/css" href="main.css">
<meta charset="utf-8">
<!--Dit laadt het Raleway lettertype: -->
<link href='https://fonts.googleapis.com/css?family=Raleway:200,300' rel='stylesheet' type='text/css'>
<!--Dit laadt jQuery: -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"> </script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"> </script>
</head>
<body>
<div class="topBar">
hoi
</div>
<div class="jumbotron">
<div class="overMij">
</div>
<div class="hobbies">
</div>
<div class="muziek">
</div>
<div class="informatica">
</div>
</div>
</body>
html, body {
margin: 0;
width: 100%;
height: 100%;
background-image: url(background.jpg)
}
.topBar {
height: 10%;
width: 100%;
background-color: blue;
}
.jumbotron {
height: 90%;
width: 100%;
}
.overMij {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
background-color: green;
background-size: 100%;
width: 60%;
height: 50%;
float: left;
border-radius: 50px;
border: solid white 25px;
}
.hobbies {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
background-color: green;
background-size: 100%;
width: 40%;
height: 50%;
float: right;
border-radius: 50px;
border: solid white 25px;
}
.muziek {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
background-color: green;
background-size: 100%;
width: 40%;
height: 50%;
float: left;
border-radius: 50px;
border: solid white 25px;
}
.informatica {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
background-color: green;
background-size: 100%;
width: 60%;
height: 50%;
float: right;
border-radius: 50px;
border: solid white 25px;
}
【问题讨论】:
-
你希望那里没有边界吗?
-
@kfreeman04208 我希望背景颜色不是 div 的整个高度和宽度,所以我尝试了填充和边距,但 60% 和 40% 很难,所以我尝试了边框,这似乎工作,但我希望边框透明并显示背景,如果你明白我的意思
-
哪个边界?里面有 4 个。
-
@Candy_In_Mah_Van 边界的目的是什么?要在
divs之间添加空格吗? -
@alirezasafian 是的,就是这样