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


Anchor Tags and Style Formatting

Hello! I would like to create the exact same page as the original except for the large car image also being a link to a car start sound. The problem I have with this is the formatting that goes along with the <a> tag. If I want to anchor some images that are big and some are small, but I have to use the same <a> tag for each, it affects the formatting and makes all the images the same size. How can I get around this?

Again, I would like the big car image to also link to a sound, but to remain a bigger size than the other buttons on the page. Thanks!!

1 Answer

Steven Parker
Steven Parker
229,577 Points

You might use a class to style the anchor images differently.

For example, you could create a "full-size" class to give the car a different width (and float setting) than the other links:

  <!--Car image -->
  <a href="javascript:revEngine();" class="full-size"><img src="images/car1.png" class="car" alt="car"></a>

  <a href="javascript:startCar();"><img src="images/key.png" alt="key"></a>
  <a href="javascript:honkHorn();"><img src="images/steering-wheel.png" alt="steering wheel"></a>
  <a href="javascript:peelOut();"><img src="images/nos.png" alt="nos"></a>
/* Links */
a {
  background: transparent;
  border: 0;
  display: block;
  float: left;
  margin: 0;
  outline: 0;
  padding: 0;
  width: 33%; 
.full-size {
  float: none;
  width: 100%;