html - 如何在css中缩小图像
问题描述
你好,我怎样才能通过 320 youtube 图标调整我的 320 大小
我希望它的大小像应用程序在桌面上看起来一样小但是我似乎无法做到这一点
.icons{
width: 30px;
height: 30px;
}
或者
<div class="icons">
<img src="/img/youtube icon.png" width: 30px; height: 30px; alt="">
</div>
这是代码
这是 HTML 代码——(Ps 我已经删除了高度和宽度代码,因为它不起作用)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/board.css">
<title>Board</title>
</head>
<body>
<div class="Board">
<div class="panel">
<div class="user">
<h3>Good Morning, Admin!</h3>
</div>
<div class="icons">
<img src="/img/youtube icon.png" alt="">
</div>
</div>
<div class="right-panel">
<div class="heading">
</div>
<div class="dashboard">
</div>
</div>
</div>
</body>
</html>
这是 CSS 代码——
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
@font-face{
src: url(/fonts/Coiny-Regular.ttf);
font-family: Coiny;
}
body, html{
background-color: rgb(230, 230, 230);
font-family: Arial, Helvetica, sans-serif;
}
.Board{
display: flex;
align-items: center;
text-align: center;
justify-content: left;
}
.panel{
background-color: white;
width: 450px;
height: 650px;
border-radius: 2rem;
margin-left: 40px;
margin-top: 30px;
box-shadow: 7px 7px 7px 7px rgba(202, 202, 202, 0.3);
}
.right-panel{
background-color: white;
width: 950px;
height: 650px;
border-radius: 2rem;
margin-left: 40px;
margin-top: 30px;
box-shadow: 7px 7px 7px 7px rgba(202, 202, 202, 0.3);
}
.user h3{
background-color: whitesmoke;
text-align: start;
padding: 20px;
font-size: 20px;
border-radius: 2rem;
font-family: Coiny, cursive;
margin: 20px;
}
谢谢!
解决方案
.icons
以该类为目标元素,因此您可以这样做
<img src="/img/youtube icon.png" class="icons" alt="">
或将您的选择器更新为该类中的目标元素:
.icons img {
width: 30px;
height: 30px;
}
推荐阅读
- google-api - AttributeError:模块“google.cloud.vision”没有属性“枚举”
- node.js - 我有nodejs但无法通过自制软件升级它,我该怎么办?
- r - 计算表格显示所需的时间
- android - MODE_IN_CALL、MODE_IN_COMMUNICATION、MODE_CALL_SCREENING 有什么区别?
- java - 当我们在Java中将map的键转换为小写时,有没有简单的方法来合并值集?
- github - github 企业是否有 Lucid 图表集成?
- karate - 空手道:带有断言的多行 afterScenario
- java - BindingResult 方法参数的存在确定抛出的异常?
- chatbot - 有没有办法识别正在使用的会话 AI 引擎(即 dialogfow、lex、watson 等)只是与聊天机器人交谈?
- geometry - 分离两个或多个多边形的坐标