Hi, I've been using your amazing Ao3 'Various Tricks to HTML Coding' resource but I've come across something I can't quite work out. I could just be being stupid!
But if I have more than one definition that then requires multiple footnote anchor points, how do I make the "back" function go back to the right place in the text?
<a href="#definition" rel="nofollow">Press here to head on back to the anchor section</a> only takes me back to the first definition and not the 2nd/3rd or whatever number in the main text. If that makes sense. I tried adding numbers after definition (<a href="#definition2") but this didn't work either.
Any help would be amazing ^_^
Hello! HTML can be kinda tricky, but I'm glad the guide has been helpful to you so far. It's actually not super clear within the guide, so I've added some extra information and a simplified version.
Here's a screenshot of what text you'd use. But you can also go straight to the guide so that you can copy and paste from there (HTML GUIDE).
here's a guide on how to do the hash change section stuff carrd does in html/javascript (so you don't have to take several days to figure it out like i did)
disclaimers:
- i am not an expert by any means so forgive me if i call things the wrong thing lol
- this guide assumes you already have all the html for your site! this wont teach you html. and it doesn't really teach you javascript either i just throw code at you honestly.
- i did Not take carrd's code, i took one look at it and ran for the hills. this is a combo of my non javascript coding experience and a couple javascript tutorials.
step 1: make sure your sections (or divs, or any content that you want to be dependent on the hash) have IDs that match the hashes you want to use! you do this by adding the attribute id="yourIdNameHere" in the opening tag. (example: <p id="blorbo">all about my blorbo</p>)
step 2: add the style="display:none;" tag to the parts you want to only show up when the hash is correct! (example: <p id="blorbo" style="display:none;">all about my blorbo</p>) this will hide them in a way that makes them not take up room on the page when it's not on their particular hash. fun fact, if you put "hidden" instead of "none" it will still take up space despite being invisible!
step 3: i did the javascript for you because javascript is a bitch. add the following into your html's body:
<script type="text/javascript">
let activeSection = null;
let previousSection = null;
window.addEventListener('hashchange', function() {
activeHash = window.location.hash.substring(1);
if(activeHash.length > 0)) {
activeSection = document.getElementById(activeHash);
if(activeSection != null) {
activeSection.style.display = "block";
if(previousSection != null) {
previousSection.style.display = "none";
}
previousSection = activeSection;
}
}
});
</script>
tldr of what that does is it tells the page to figure out what it should be showing based on the hash in the url! long explanation below
basically that makes room for the page to know what the section it's supposed to have open is and what the last section it had open was, then tells it to listen for when the hash on the url changes, and that when that happens it needs to get the new hash, find the new section it's supposed to have open, open it if it exists, and hide the previous section if it exists. then it saves the current section as the previous section, so that the next time the hash changes it knows what to hide!
you should be done now and it should work! congrats!
if it's not working for any reason please lmk and i will try to help but i am also a noob lol
This HTML tutorial has been designed for newbie Web designers and developers who are seeking the platform to learn HTML from the scratch. The practical examples
A few HTML editors become popular due to their excellent features and high-end performance. We have listed top 10 HTML editors which you can download from links
HTML editor is the basic thing that you need to get started with your coding or developing a web page. This tutorial will help you to learn how to set up editor
This tutorial will let you to learn HTML elements and attributes. They have been explained with detailed examples. The types of HTML elements and attributes