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

CSS

Trouble adding a Modal Box

I am trying to make a model box that opens when they click on the Choose options button. Right now the Choose options button is above the clickable model box but I can not figure out how to make the Choose options buttons open the model box when clicked on. I have attached the code below. Thanks in advance http://codepen.io/Johned22/pen/ORKqWj

2 Answers

Julian Gutierrez
Julian Gutierrez
19,325 Points

An anchor with the href of "#openModal" is what fires off the modal in your example. You could include that in your div and just add some css to the anchor to fill the div.

<div id="select"><a href="#openModal">CHOOSE OPTIONS</a></div>
#select a{
  display:block;
}

Thanks that solved my problem.