Home › Forums › CSS › Having trouble linking files together › Reply To: Having trouble linking files together
I think I understand what you’re trying to do.
But take a look at your markup and you should be able to see why certain undesirable behaviours are present; Clicking a link in the first demo takes you to a second page. That’s happening because you’re linking to a second page
<a href="beginnermensdescription2.html">. If you don’t want that to happen, don’t use an anchor element with an href value that targets another web page.
Let’s not focus on that code for a minute though. Instead, concentrate on fixing the 2nd demo;
<a href="#openModal" src="beginnermensimage.jpg" target="_blank">
You can’t have a src attribute in an anchor – so take it out. And you don’t need to open up anything in a new page because you’re targeting an id of an element that’s on the same page ( the #openModal part) – so take out
You’ll probably find that the 2nd demo behaves more like expected once you’ve made these changes. And with this cleaner markup, you should find it easier to merge the image from the 1st demo over into the 2nd (the image replaces the SELECT OPTION text if I understand correctly).