gpt4 book ai didi

html - CSS 类不适用于元素(边框宽度、颜色和样式属性)

转载 作者:行者123 更新时间:2023-11-28 04:18:41 24 4
gpt4 key购买 nike

您好,我正在 freecodecamp.com 上一门类(class),我应该通过一个类为图像添加边框宽度颜色和样式。

不过我运气不好。我看不出我做错了什么。

.thick-green-border {
border-width: 10px border-color: green border-style: solid;
}
.red-text {
color: red;
}
h2 {
font-family: Lobster, Monospace;
}
p {
font-size: 16px;
font-family: Monospace;
}
.smaller-image {
width: 100px;
}
<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>


<h2 class='red-text'>CatPhotoApp</h2>

<img class='smaller-image thick-green-border' src='https://bit.ly/fcc-kittens' />

最佳答案

您需要使用分号分隔 border-width:10px border-color:green border-style:solid; 中的每个属性,例如 border-width:10px;边框颜色:绿色;边框样式:纯色;

  .thick-green-border {
border: 10px;
border-color: green;
border-style: solid;
}
.red-text {
color: red;
}
h2 {
font-family: Lobster, Monospace;
}
p {
font-size: 16px;
font-family: Monospace;
}
.smaller-image {
width: 100px;
}
<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>
<h2 class='red-text'>CatPhotoApp</h2>

<img class='smaller-image thick-green-border' src='https://bit.ly/fcc-kittens' />

关于html - CSS 类不适用于元素(边框宽度、颜色和样式属性),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30712993/

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