[ACCEPTED]-I would like to apply css to the first image-css

Accepted answer
Score: 11

:first-child selects for only the first child of the 4 parent element. In OPs example :first-child would be 3 the h1 so img:first-child would not actually select anything.

Use 2 nth-of-type(1) instead.

<!-- in the head -->
.post_locked2 img:nth-of-type(1){
  border:5px solid red;

<!-- in the body -->
<div class="post_locked2">
<img class="aligncenter" src="http://www.what...
<img title="RockDizFile" src="http://......
<img title="Bullet" src="http://wwww.......

And here's another example of 1 it in use: http://jsfiddle.net/FsEhD/

Score: 0

Have you tried this?

post_locked2>.aligncenter:first-child {some:styles;}


post_locked2>img:first-child {some:styles;}


More Related questions