2

I am creating an experimental website. The page visitors view has four embedded elements. I would like the user to be able to click on one embed to advance to the next one further down the page. Here is what I tried:

<a href="#2"><embed src="index.html" height="1000px" width="1300px"></a>

<div id="2"><embed src="2.html" height="1000px" width="1300px"></div>

And

<a href="#2"><embed src="index.html" height="1000px" width="1300px"></a>

<embed src="2.html" id="2" height="1000px" width="1300px">

In both cases the link doesn't work. The embed tag can't be clicked on.

Frisby
  • 71
  • 1
  • 4

2 Answers2

5

I discovered the same issue occurs with the object tag and found the solution here: make an html svg object also a clickable link

The embed must be set to pointer-events: none; and the anchor tag must be set to display:inline-block; My final code is:

<style type="text/css">
embed{
     pointer-events: none;
}

a{
    display:inline-block;
}
</style>

and

<a href="#2"><embed src="index.html" id="1"></a>

<embed src="2.html" id="2">
Community
  • 1
  • 1
Frisby
  • 71
  • 1
  • 4
-1

the problem is you are using numbers for id it isn't allowed , id consider as variable name so the rules that applied to variable naming applied here also, change id name starting with letter like "id2" then it will work...

<a href="#d">this is the link to d</a>

<div id="d"><embed src="d2.html" height="1000px" width="1300px"></div>
Aylian Craspa
  • 422
  • 5
  • 11
  • 1
    I'm not sure that's actually true...here's what W3C says the rules are. http://www.w3schools.com/tags/att_global_id.asp I've used numbers for ids before. In any case this still isn't solving the issue: I need a link to wrap the embed so that the embed can be clicked on. When I wrap the embed in a link, the embed is not clickable. – Frisby Mar 30 '16 at 15:48