Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Christian Kroul
Christian Kroul
9,849 Points

Naming with Php

whenever in Css i type .gallery to style that div class, nothing happens. What do i have to do to my code, to make the .gallery class work?

$team = array(
  "Bob" => "img/Cool-Calif-sign.jpg",
  "Jason" => "img/Cool-Calif-sign.jpg",
       );

?>
<h1>Welcome to our team</h1>
<div class="gallery">
<?php
foreach ( $team as $key => $value ) {
  echo "<img class=$team src=$value>";
}
?>
</div>

2 Answers

Roy Penrod
Roy Penrod
19,810 Points

If you're trying to style the images within the gallery, you'll want to use this CSS selector:

.gallery img {
   // your styles go here
}

I would avoid using the class for the img because it's generated dynamically and it will change depending on your dataset.