<a href="page-url" style="pointer-events: none;">Click here</a>Many role :target to become inwards work, however, this is non ever the best selection if nosotros see its jumping demeanor - click on the link below to run into what happens:
Link alongside target
Lorem ipsum dolor sit down amet, consectetur adipiscing elit. Nam eu cursus dui, ac fermentum eros. Interdum et malesuada fames ac ante ipsum primis inwards faucibus. Fusce elementum sapien et augue fringilla aliquam. Ut a viverra libero, eget commodo nisi. Maecenas ultrices facilisis dignissim.
<style>Another alternative is to role the :focus selector which volition brand the hidden content to expand on mouse click.
#linktarget {display: none;}
#linktarget:target {display: block;}
</style>
<a href="#linktarget">Link alongside target</a>
<div id="linktarget">
Lorem ipsum dolor sit down amet, consectetur adipiscing elit. Nam eu cursus dui, ac fermentum eros. Interdum et malesuada fames ac ante ipsum primis inwards faucibus. Fusce elementum sapien et augue fringilla aliquam. Ut a viverra libero, eget commodo nisi. Maecenas ultrices facilisis dignissim.
</div>
The payoff of this selector is that the page stays still, however, nosotros bring to click anywhere "outside" to unopen the expanded content together with also this, the hidden content should endure right away after, alongside no intermediate tags:
Demo alongside focus
Lorem ipsum dolor sit down amet, consectetur adipiscing elit. Nam eu cursus dui, ac fermentum eros. Interdum et malesuada fames ac ante ipsum primis inwards faucibus. Fusce elementum sapien et augue fringilla aliquam. Ut a viverra libero, eget commodo nisi. Maecenas ultrices facilisis dignissim.
<style>The final method is to a greater extent than fancy fifty-fifty though it requires to a greater extent than tags but it plant the best since it allows us to practice a toggle effect, i.e., expand on click together with and thus collapse when clicking again. In this case, we'll role the :checked selector:
.focuselector {display: none;}
span:focus .focuselector {display: block;}
</style>
<span tabindex="0">Link alongside focus</span>
<div class="focuselector">
Lorem ipsum dolor sit down amet, consectetur adipiscing elit. Nam eu cursus dui, ac fermentum eros. Interdum et malesuada fames ac ante ipsum primis inwards faucibus. Fusce elementum sapien et augue fringilla aliquam. Ut a viverra libero, eget commodo nisi. Maecenas ultrices facilisis dignissim.
</div>
Lorem ipsum dolor sit down amet, consectetur adipiscing elit. Nam eu cursus dui, ac fermentum eros. Interdum et malesuada fames ac ante ipsum primis inwards faucibus. Fusce elementum sapien et augue fringilla aliquam. Ut a viverra libero, eget commodo nisi. Maecenas ultrices facilisis dignissim.
<style>To apply these effects on the links together with content that yous desire to enshroud together with expand alone on mouse click is real easy: when yous practice a post, glue i of the codes higher upwards within the HTML box together with supercede the text inwards blueish alongside the advert of your link together with add together your text instead of the light-green one.
.checked-selector {display: none;}
:checked .checked-selector {display: block;}
input.hidden[type=checkbox] {position: absolute;left: -999em;}
</style>
<label for="toggle-hidden">Demo alongside checked</label>
<input type="checkbox" id="toggle-hidden" class="hidden" />
<div class="checked-selector">
Lorem ipsum dolor sit down amet, consectetur adipiscing elit. Nam eu cursus dui, ac fermentum eros. Interdum et malesuada fames ac ante ipsum primis inwards faucibus. Fusce elementum sapien et augue fringilla aliquam. Ut a viverra libero, eget commodo nisi. Maecenas ultrices facilisis dignissim.
</div>
Comments