gpt4 book ai didi

html - 隐形边框无法正常工作

转载 作者:行者123 更新时间:2023-11-28 16:44:45 25 4
gpt4 key购买 nike

我正在制作一个网站,但是当我想让边框透明以从 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;
}

最佳答案

您可以为此使用background-clip:

* {
box-sizing: border-box;
}

body {
background: #bada55;
}

div {
width: 250px;
height: 250px;
margin: 25px auto;
border:2px solid grey;
padding:10px;
background: #f00;
background-clip: content-box;
}
<div></div>

Background-clip @ MDN

Support @ CanIUse.com

关于html - 隐形边框无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33348900/

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