Reputation: 67
Hello how can I resize my 320 by 320 youtube Icon
I want it the size of an icon like apps look in the desktop small however I can't seem to be able to do that with
.icons{
width: 30px;
height: 30px;
}
or
<div class="icons">
<img src="/img/youtube icon.png" width: 30px; height: 30px; alt="">
</div>
here's the code
this is the HTML code -- (Ps I have removed the height and width code as it did not work)
<!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>
This is the CSS code --
*{
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;
}
Thanks!
Upvotes: 0
Views: 97
Reputation: 1183
.icons
targets elements with that class so you can either do
<img src="/img/youtube icon.png" class="icons" alt="">
or update your selector to target elements within that class:
.icons img {
width: 30px;
height: 30px;
}
Upvotes: 3
Reputation: 2497
There are multiple ways to do this, but I think with your example in your question you have improper coding to get the width and height of your image:
For example, this:
<div class="icons">
<img src="/img/youtube icon.png" width: 30px; height: 30px; alt="">
</div>
Should look like this:
<div class="icons">
<img src="/img/youtube icon.png" width="30px" height="30px" alt="">
</div>
If you were doing inline style, which I wouldn't recommend, you could do something like this:
<div class="icons">
<img src="/img/youtube icon.png" style="width: 30px; height: 30px;" alt="">
</div>
The best way to do this would just to have a simple css like this:
.icons img { width:30px; height: 30px; }
Upvotes: 2
Reputation: 2468
Move your class on img
instead on div
:
<div>
<img class="icons" src="/img/youtube icon.png" alt="">
</div>
Upvotes: 1