1

wondering if anybody can help a newbie? My code seems to work fine in Chrome but it doesn't display in IE.

The intention of the code is to show or hide a piece of text. This works fine in Chrome, but does not load correctly in IE10. Due to restrictions with the application I am using, I am unable to use javascript or any derivative.

Apologies if I have overlooked an article or post on this topic already, but I cannot see a relevant solution.

.answer,
#shown,
#hideaway:target {
  display: none;
}

#hideaway:target+#shown,
#hideaway:target~.answer {
  display: initial;
}
<a href="#hideaway" id="hideaway">Click here for text</a>
<a href="#shown" id="shown">Hide text</a>
<div class="answer">
  <P>Text Goes Here</P>
</div>

Thanks in anticipation for any help you can provide!

3 Answers 3

2

You should try using the IE developer tools, you probably would have found the answer.

Anyway, initial is not supported by IE

As answer is a div, display: initial will be the same as display: block.

Sign up to request clarification or add additional context in comments.

2 Comments

This would be a better answer if you proposed an alternative.
0

You can change the display: inital, to block. Because initial is not supported by any version of IE

.answer,
#shown,
#hideaway:target {
  display: none;
}

#hideaway:target+#shown,
#hideaway:target~.answer {
  display: block;
}
<a href="#hideaway" id="hideaway">Click here for text</a>
<a href="#shown" id="shown">Hide text</a>
<div class="answer">
  <P>Text Goes Here</P>
</div>

1 Comment

Thanks for your help!
0

The initial keyword is not supported in Internet Explorer 11 and earlier versions.

Use Display:block instead .

<style>
.answer,
#shown,
#hideaway:target{
display: none;
}
#hideaway:target + #shown,
#hideaway:target ~ .answer{
display: block;}
</style>


</head>
<body>

<a href="#hideaway" id="hideaway">Click here for text</a>
<a href="#shown" id="shown">Hide text</a>
<div class="answer">
<P>Text Goes Here</P>
</div>
</body>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.