P4PL4
P4PL4

Reputation: 13

Cannot select an image inside a div in CSS to apply style to it

So I have an ID which is not working when I try to select it in CSS. It works fine when I leave the ID out and just write img{} but want to select that specific image so I do not have to apply it to all images. P.S. I am using Brackets.

#contactmain img {
    width: 100%;
    padding: 0;
    margin: 0;
}
  <div id:"contactmain";>
    <img src="roses.jpg">
  </div>

Upvotes: 0

Views: 264

Answers (2)

Kevs
Kevs

Reputation: 31

Change

<div id:"contactmain";>

to

<div id="contactmain">

Upvotes: 2

Kevin Lynch
Kevin Lynch

Reputation: 24703

Syntax error

<div id:"contactmain";>

Should be

<div id="contactmain">

Upvotes: 2

Related Questions