gpt4 book ai didi

html - 这张卡的顶部和底部有两个空格,我无法消除。

转载 作者:行者123 更新时间:2023-11-28 00:56:08 25 4
gpt4 key购买 nike

我试过使用“*{margin: 0;padding: 0;}”。我还尝试在 div 元素周围设置负边距。虽然此解决方案处理顶部空白,但底部空白缺少 15px 的填充。在这方面的任何帮助将不胜感激。这是卡片的图片。 card

这是 HTML 和 CSS

/* add your CSS here */

.fact{
font-style: italic;
}
.items{
font-weight: bold;
}
ul {

list-style-type: none;
padding: 0px;
}
body{

border: 1px solid #D9D9D9;
box-shadow: 7px 7px 1px #e9e9e9;
box-sizing: border-box;
width: 330px;
}
.info{
margin: 15px 15px 30px;
padding: 0px 15px 0px;
border:1px solid #D9D9D9;
}
h3{
padding: 25px 15px 0px;
font-size: 1.5em;
}
.image{
padding: 0px 15px;
width: 300px;
}
.all{

background-color: #c9b3b5;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Animal Trading Cards</title>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<div class="all">
<!-- your favorite animal's name goes here -->
<h3>Tyrannosaurus</h3>
<!-- your favorite animal's image goes here -->
<img src="https://img.purch.com/rc/300x200/aHR0cDovL3d3dy5saXZlc2NpZW5jZS5jb20vaW1hZ2VzL2kvMDAwLzA1OS81NTgvb3JpZ2luYWwvbmV3LWRpbm9zYXVyLTEzMTEyMi5qcGc=" alt="Tyrannosaurus" class="image">
<div class="info">
<!-- your favorite animal's interesting fact goes here -->
<p class="fact">Tyrannosaurus' fossil remains are relatively rare, as of 2012 only 44 specimens had been found, including three complete skulls.</p>
<ul>
<!-- your favorite animal's list items go here -->
<li><span class="items">Scientific name</span>: Tyrannosaurus</li>
<li><span class="items">Speed</span>: 40 Km/h</li>
<li><span class="items">Family</span>: Tyrannosauridae</li>
<li><span class="items">Rank</span>: Genus</li>
</ul>
<!-- your favorite animal's description goes here -->
<p>Like other tyrannosaurids, Tyrannosaurus was a bipedal carnivore with a massive skull balanced by a long, heavy tail. Relative to its large and powerful hind limbs, Tyrannosaurus fore limbs were short but unusually powerful for their size and had two clawed digits. </p>
</div>
</div>
</body>
</html>

/* add your CSS here */

.fact{
font-style: italic;
}
.items{
font-weight: bold;
}
ul {

list-style-type: none;
padding: 0px;
}
body{

border: 1px solid #D9D9D9;
box-shadow: 7px 7px 1px #e9e9e9;
box-sizing: border-box;
width: 330px;
}
.info{
margin: 15px 15px 30px;
padding: 0px 15px 0px;
border:1px solid #D9D9D9;
}
h3{
padding: 25px 15px 0px;
font-size: 1.5em;
}
.image{
padding: 0px 15px;
width: 300px;
}
.all{

background-color: #c9b3b5;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Animal Trading Cards</title>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<div class="all">
<!-- your favorite animal's name goes here -->
<h3>Tyrannosaurus</h3>
<!-- your favorite animal's image goes here -->
<img src="https://img.purch.com/rc/300x200/aHR0cDovL3d3dy5saXZlc2NpZW5jZS5jb20vaW1hZ2VzL2kvMDAwLzA1OS81NTgvb3JpZ2luYWwvbmV3LWRpbm9zYXVyLTEzMTEyMi5qcGc=" alt="Tyrannosaurus" class="image">
<div class="info">
<!-- your favorite animal's interesting fact goes here -->
<p class="fact">Tyrannosaurus' fossil remains are relatively rare, as of 2012 only 44 specimens had been found, including three complete skulls.</p>
<ul>
<!-- your favorite animal's list items go here -->
<li><span class="items">Scientific name</span>: Tyrannosaurus</li>
<li><span class="items">Speed</span>: 40 Km/h</li>
<li><span class="items">Family</span>: Tyrannosauridae</li>
<li><span class="items">Rank</span>: Genus</li>
</ul>
<!-- your favorite animal's description goes here -->
<p>Like other tyrannosaurids, Tyrannosaurus was a bipedal carnivore with a massive skull balanced by a long, heavy tail. Relative to its large and powerful hind limbs, Tyrannosaurus fore limbs were short but unusually powerful for their size and had two clawed digits. </p>
</div>
</div>
</body>
</html>

最佳答案

就是margin,设置h3 margin-top为0会去除top gap。

对于底部,将 .info 边距设置为 margin: 15px 15px 0;(即顶部 15px 左侧/右侧 15px 底部 0px)。

.info{  
margin: 15px 15px 0;
padding: 0px 15px 0px;
border:1px solid #D9D9D9;
}
h3{
padding: 25px 15px 0px;
font-size: 1.5em;
margin-top: 0;
}

/* add your CSS here */

.fact {
font-style: italic;
}

.items {
font-weight: bold;
}

ul {
list-style-type: none;
padding: 0px;
}

body {
border: 1px solid #D9D9D9;
box-shadow: 7px 7px 1px #e9e9e9;
box-sizing: border-box;
width: 330px;
}

.info {
margin: 15px 15px 0;
padding: 0px 15px 0px;
border: 1px solid #D9D9D9;
}

h3 {
padding: 25px 15px 0px;
font-size: 1.5em;
margin-top: 0;
}

.image {
padding: 0px 15px;
width: 300px;
}

.all {
background-color: #c9b3b5;
}
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>Animal Trading Cards</title>
<link href="styles.css" rel="stylesheet">
</head>

<body>
<div class="all">
<!-- your favorite animal's name goes here -->
<h3>Tyrannosaurus</h3>
<!-- your favorite animal's image goes here -->
<img src="https://img.purch.com/rc/300x200/aHR0cDovL3d3dy5saXZlc2NpZW5jZS5jb20vaW1hZ2VzL2kvMDAwLzA1OS81NTgvb3JpZ2luYWwvbmV3LWRpbm9zYXVyLTEzMTEyMi5qcGc=" alt="Tyrannosaurus" class="image">
<div class="info">
<!-- your favorite animal's interesting fact goes here -->
<p class="fact">Tyrannosaurus' fossil remains are relatively rare, as of 2012 only 44 specimens had been found, including three complete skulls.</p>
<ul>
<!-- your favorite animal's list items go here -->
<li><span class="items">Scientific name</span>: Tyrannosaurus</li>
<li><span class="items">Speed</span>: 40 Km/h</li>
<li><span class="items">Family</span>: Tyrannosauridae</li>
<li><span class="items">Rank</span>: Genus</li>
</ul>
<!-- your favorite animal's description goes here -->
<p>Like other tyrannosaurids, Tyrannosaurus was a bipedal carnivore with a massive skull balanced by a long, heavy tail. Relative to its large and powerful hind limbs, Tyrannosaurus fore limbs were short but unusually powerful for their size and had
two clawed digits. </p>
</div>
</div>
</body>

</html>

关于html - 这张卡的顶部和底部有两个空格,我无法消除。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44848671/

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