Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

HTML & CSS Trouble modifying an id for an image in a div element

Hello everybody 😊

I'm super green when it comes to coding. I've only been working on it for around 3 weeks. I'm working through freeCodeCamp and I am doing one of the assignments where I have to add the id "img-div" to a div element, but when I try to modify it in CSS through VS Code, I get an error message on the CSS side saying "Do not use empty rulesets". I have made other ids in this code and everything works fine, but with this div that contains an image, it's not working at all.

I've had to resort to using div to modify anything related to the image. What's wrong? Please help.

Thank you!

-Brandi


CSS-img-div-problem.jpgHTML-img-div-problem.jpg
 
EDIT: Oops, I think I needed to put my code through here:

[CODE lang="html" title="HTML"]<div id="img-div">
<img src="snoopy.png" alt="Side profile of a sweet animated beagle">
</div>[/CODE]

[CODE lang="css" title="CSS"]#img-div {

}[/CODE]

Sorry for the original clunky message above. But curious if the images are helpful or not? Thanks.
 
Paste the full html and css code here.
[CODE lang="html" title="HTML"]<!DOCTYPE html>

<html>
<head id="main">
<title>Snoopy Tribute Page</title>
<link href="styles.css" rel="stylesheet" type="text/css">
</head>


<body>
<h1 id="title">SNOOPY</h1>
<h2 id="subtitle">not your average beagle</h2>
<div id="img-div">
<img src="snoopy.png" alt="Side profile of a sweet animated beagle" id="image">
</div>


</body>

</html>[/CODE]

[CODE lang="css" title="CSS"]#title {
font-family: 'Patrick Hand', cursive;
color:#FF0000;
text-align: center;
}
#subtitle {
font-family: Dosis, sans-serif;
color: #ffc300;
text-align: center;
}
#img-div {

}
[/CODE]
 

Latest posts

Buy us a coffee!

Buy me a coffee.
Back
Top Bottom