user2259723
user2259723

Reputation: 13

How do I get the right selector to style this image?

I'm trying to style the image here:

<div id="site-title">
<a href="http://**.com/" rel="home">
<img src="http://**.com/wp-content/uploads/2013/05/transparent-logo.png" alt="" width="369" height="66">
</a>
<a class="home" href="http://**.com/" rel="home"></a>
</div>

I tried to use the selector

#site-title a img {
}

But that doesn't seem to be accessing the image. What am I doing wrong?

Upvotes: 0

Views: 59

Answers (3)

AJStacy
AJStacy

Reputation: 5233

It looks like you may have modified your question to fix a typo that the previous answers brought up.

#site-title a img {}

If you have your selector formatted in that way it should work.

Upvotes: 0

underscore
underscore

Reputation: 6887

The id Selector

The id selector is used to specify a style for a single, unique element.

The id selector uses the id attribute of the HTML element, and is defined with a "#".

The style rule below will be applied to the element with id="InHereWeAreUsingId":

http://www.w3schools.com/cssref/sel_id.asp

http://www.w3.org/TR/CSS2/selector.html

http://www.w3schools.com/css/css_id_class.asp

HTML

<div id="InHereWeAreUsingId">In Here We are using a Id to Identify this div </div>

CSS

#InHereWeAreUsingId
{
text-align:center;
color:red;

}

So In your question

HTML

<div id="site-title">
<a href="http://**.com/" rel="home">
<img src="http://**.com/wp-content/uploads/2013/05/transparent-logo.png" alt="" width="369" height="66">
</a>
<a class="home" href="http://**.com/" rel="home"></a>
</div>

CSS

#site-title > img{




}

Upvotes: 0

Arbel
Arbel

Reputation: 30999

Use

#site-title img { /* Your styles here*/ }

Upvotes: 1

Related Questions