Why doesn’t this hyperlink work as written here? - html

Following is html code. The final div is a hyperlink that calls javascript. This is the bottom of a longer page, but everything works until the final hyperlink, which appears on the page but not as a clickable link.
<div style="padding-left:15%;">
<span class="blank">Action Hyperlink</span>
</div><br>
<div class="sp_01 bordered">
<ul class="sp_03 bordered">
<li class="sp_03 bordered" style="text-align:justify;">Text 1</li><br>
<li class="sp_03 bordered" style="text-align:justify;">Text 2</li><br>
<li class="sponsor_03 bordered" style="text-align:justify;">Text 3</li>
</ul>
</div><br><br>
<div style="padding-left:15%;">
<span class="blank">Action Hyperlink</span>
</div><br>
The first instance of the hyperlink works. After the -div class="sp_01 bordered"- section, the final instance of the hyperlink appears as a line but not a click link.
This sort of problem is usually related to how the preceding tags are open and closed. I’ve studied the open and close tags and I don’t see anything wrong. The color coding in my editor (Atom) is correct for all tags.
What’s wrong?

Just wrap your DIV inside a like
<a href="#" onclick="ShowPages(18);" class="tfl" style="text-decoration: none; color:rgb(255,255,255)"><span class="blank">Action Hyperlink</span>
<div style="padding-left:15%;">
</div>
</a>
<br>
Edit
For future references this answer don't include sufficient information . So that I was trying to delete this. But after answer beign accepted it cant be deleted.

Related

Tutorial I followed left '#' in place of links in buttons. How can I fix that if I want to host it on an actual server?

I'm a beginner in HTML and CSS and I watched this guy's tutorial on how to build a portfolio.
In the 'nav' class, he left the code as such,
<div class="nav">
<a class="a active" href="#">Home</a>
<a class="b"href="#">Gear</a>
<a class="c" href="#">Colour Dump</a>
<a class="d" href="#">BnW Dump</a>
</div>
The website he is building seems to be more of a local based html file and not meant to be hosted on actual server as there isn't any links in the buttons. How would I go about fixing this? I plan to host the website on an actual web server and I just tested it, the buttons do not lead anywhere due to a lack of buttons.
Here is a pastebin leading to my html file and
one to my css file.
My apologies if some of the classes names are misleading (i.e. do not match up to the titles), I was following his tutorial and only edited the details afterwards.
Thank you in advance for any help rendered!!
Your href links in a navigation will most likely link to another page on your website like this:
<div class="nav">
<a class="a active" href="/about">Home</a>
</div>
Another option would be an anchor link. This is the case for example if you have a single page website.
<div class="nav">
<a class="a active" href="#about">Home</a>
</div>
// Jumps to the element with the id="about"
If your nav would link to another website it would look something like this
<div class="nav">
<a class="a active" href="https://example.com">Go to Example</a>
</div>
// This link is external
Also interesting is to learn about the different attributes for links. You can find a goof read here.

Anchor links just won't work

I am working on a bespoke WordPress build and for some reason, I just cannot get some anchor links to work. It's driving me potty and I just don't know what the problem is.
I have discovered, static anchor links are working fine (the back to top button works). However, I am using Advanced Custom Fields to generate ID's for the anchor tags. The IDs are generating correctly, but won't work as anchor tags.
Anyone have any ideas? The bit I am referring to is the service boxes near the bottom of the page. The idea being you click on these and that they will take you to the services page, and down to the relevant section.
The markup I am using is:
<ul class="cf">
<li>
<div>
<a href="/services/#dimensional-surveys">
<div class="filter"></div>
<img width="500" height="600" src="pexels-photo-175771-500x600.jpeg" class="attachment-feature size-feature" alt="" />
<h3>3D Dimensional Surveys</h3>
</a>
</div>
</li>
</ul>
<ul class="service-list cf">
<li id="#dimensional-surveys">
<div class="feature" style="background-image:url(pexels-photo-175771.jpeg);">
</div>
</li>
</ul>
Just remove the # from id and it will work.
<ul>
<li id="example"></li>
</ul>
I have looked at your page
The point where an ancor should jump to should have no #
You do: <li id="#dimensional-surveys">
But do just <li id="dimensional-surveys">
Fix that first and test again.
You don't want the '#' on the anchor: <li id="#example"></li> should be <li id="example"></li>

Linking an image breaks slider

I'm using a hybrid HTML/CSS/Java coding sheet that I copied and modified for my own use. So far, the customization has gone well except for trying to link images. The weird thing about it is, it only messes up when I link the first image.
When I link the first image, none of them will show up. If I link only the second and third, all of the images show up and the last two slides even link. I have looked through many times and I still can't understand why it won't work. There isn't anything in the Javascript (that I can see) that doesn't allow links and being that they're simple <li> it seems like it should work normally. Any ideas?
This is the part I'm having issues with:
<div class="container">
<div class="slider_wrapper">
<ul id="image_slider">
<li><img src="/assets/SLC_SewingMachineThread_banner.jpg"></li>
<li><a href="Teddy-Bear-Pattern-Pack">
<img src="assets/SLC_TeddyBear_Pattern_Banner.jpg"></a>
</li>
<li><a href="Leather/Pre-Cut-Leather-Pieces/Oil-Tan-Pre-Cuts">
<img src="assets/SLC_OilTan_PreCut_banner.jpg"></a>
</li>
</ul>
<span class="nvgt" id="prev"></span>
<span class="nvgt" id="next"></span>
</div>

<li> does not display

In the middle of my page I have this <div> which includes a list. When I view the page source I see all the code there, but the only thing actually rendered for the user to see in the browser is the "Brand" h4 heading. (note that this is actually generated dynamically, and this is example output)
Also I have checked in several different browsers on several different machines so I don't think thats the issue
Is there something obvious I'm missing here why my list is not displaying?
<div class="filter-group filter-group-brand">
<h4>Brand</h4>
<ul class="nav-brand ">
<li class="collection-container aimpoint active ">
<div class="collection-name">
<a title="Narrow selection to products matching tag aimpoint"
href="/collections/firearm-accessories/aimpoint">
<i class="check-icon"></i> Aimpoint
</a>
</div>
</li>
<li class="collection-container aimshot active ">
<div class="collection-name">
<a title="Narrow selection to products matching tag aimshot"
href="/collections/firearm-accessories/aimshot">
<i class="check-icon"></i> Aimshot
</a>
</div>
</li>
<li class="collection-container barska-optics active ">
<div class="collection-name">
<a title="Narrow selection to products matching tag barska-optics"
href="/collections/firearm-accessories/barska-optics">
<i class="check-icon"></i> Barska Optics
</a>
</div>
</li>
</ul>
</div>
Without any CSS this works well and <li> elements will appear. Always think about giving your CSS code when you have a display error/problem
You must have an error in your CSS file. Check for display:none or hidden properties, etc on the following classes : collection-name, new-brand, collection-container.
Also you have empty <i> tags, just in case it's an error.

automatically added <a> tags

I have a weirdest thing, in this peace of code a browser adds tags automatically. I disabled all javascript and css, left only simple HTML and still see tags added. Here is my code:
<div id="menu-contact" class="menuNew">
<ul class="navi-list">
<li class="goto">Go to:</li>
<li id="whats">Welcome!</li>
<li>About</li>
<li>Shop</li>
<li><a class="active" href="#menu-contact">Contact</a></li>
</ul>
</div>
and here is what firefox4 sees:
<div id="menu-contact" class="menuNew">
<a> </a>
<ul class="navi-list">
<a>
<li class="goto">Go to:</li>
</a>
<li id="whats">
<a></a>
Welcome!
</li>
<li>
About
</li>
<li>
Shop
</li>
<li>
<a class="active" href="#menu-contact">Contact</a>
</li>
</ul>
</div>
It basically surrounds each tag by a tag. Again, I removed all js and css references..any idea what's going on?? Funny thing, that I have the same code (with unique IDs) in the same page and it renders normally.. only the last snippet adds tags..
My best guess absent a link to a live example is that there is a stray <a> somewhere above that element, and Firefox is attempting to apply it to all the elements below, and of course not having a very happy time of it. A quick HTML validation will reveal if something like that is going on, since either the <a> is unclosed (invalid) or the <ul> is inside it (also invalid).
If that doesn't explain it (which is entirely possible, since I'm just speculating wildly), consider crafting a live example we can inspect in detail. Certainly what you're describing is not normal Firefox behavior, so any clues we can get to what makes your situation different will help.