Trying to get invisible hyperlink - html

My Code: https://jsfiddle.net/zL5b22bb/1/
Code 1. This is the original code showing the hyperlink border after you click on the image. It's clearly visible.
<a href="http://5645646/" target="_blank">
<img style="display:inline-block;background-color:#000000; width: 100px; height: 100px; cursor: pointer;border: 5px solid #0F16FD;"
onmouseover="this.src='http://i.imgur.com/ra4471G.png';
this.style.color='white'
this.style.border='5px solid #66A4F2'"
onmouseout="this.src='http://i.imgur.com/awwMlPD.png';
this.style.color='white'
this.style.border='5px solid #0F16FD' "
/></a>
Code 2. After I remove the "img tag" the the hyperlink border is not visible. Which is what I want. But, by removing "img tag", the onmouseover background image gets disabled which is what I don't want.
<a href="http://5645646/" target="_blank" style="display:inline-block;background-color:#000000; width: 100px; height: 100px; cursor: pointer;border: 5px solid #0F16FD;"
onmouseover="this.src='http://i.imgur.com/ra4471G.png';
this.style.color='white'
this.style.border='5px solid #66A4F2'"
onmouseout="this.src='http://i.imgur.com/awwMlPD.png';
this.style.color='white'
this.style.border='5px solid #0F16FD' "
/></a>
Code 3. Now the hyperlink is invisible after you click on it, but the borders double up onmouuseover which messes it all up.
<a href="http://5645646/" target="_blank" style="display:inline-block;background-color:#000000;color:white; width: 100px; height: 100px; cursor: pointer;border: 5px solid #0F16FD;">
<img src="http://i.imgur.com/awwMlPD.png" width="100px" height="100px"
onmouseover="this.src='http://i.imgur.com/ra4471G.png';
this.style.border='5px solid #66A4F2'"
onmouseout="this.src='http://i.imgur.com/awwMlPD.png';
this.style.border='5px solid #0F16FD' "
/>
Everything is in the jsfiddle link.
I'm trying to get it to where you can have 2 color borders while keeping the hyperlink invisible with onmouseover working.
Is there a less complicated method than doing this? https://jsfiddle.net/fcdy4ocw/4/
<a id="test" href="http://5645646/" target="_blank" style="color:white; display:inline-block;background:#000000 url(http://i.imgur.com/awwMlPD.png);width:100px;height:100px;cursor:pointer;border:5px solid #0F16FD;" onmouseover="this.style.border='5px solid #66A4F2';
this.style.background='#000000 url(http://i.imgur.com/ra4471G.png)';" onmouseout="this.style.border='5px solid #0F16FD';
this.style.background='#000000 url(http://i.imgur.com/awwMlPD.png)';"></a>

Related

Make a regular button look like slack

I have a button which when pressed revokes a user's access token. I want to make it look like the Sign in with Slack button.
I am attaching the html code for the Sign in with Slack Button below.
<a href="https://slack.com/oauth/authorize?scope=identity.basic,identity.email,identity.team,identity.avatar&client_id=373568302675.374024189699">
<img alt="Sign in with Slack" height="40" width="172" src="https://platform.slack-edge.com/img/sign_in_with_slack.png" srcset="https://platform.slack-edge.com/img/sign_in_with_slack.png 1x, https://platform.slack-edge.com/img/sign_in_with_slack#2x.png 2x"
/>
What do I need to do to make my button look the same?
For now, the code for my button is as under:
<input type="button" value="Unlink Slack" onclick="location.href='#Url.Action(" RevokeAuth ","Settings ")'"/>
Is this what you were looking for I added the input to a div with the slack image and added the onclick to the div as well as the button so the pointer looks correct.
<style>
.slk {
border: 1px solid #C8C8C8;
width: 170px;
width: 170px;
border-radius: 5px;
display: flex;
height: 35px;
cursor: pointer;
}
.slkInp {
color: #383838;
background-color: white;
border: none;
padding: none;
font-size: 15px;
font-weight: bold;
}
.slkInp:hover {
cursor: pointer;
}
</style>
<div class="slk" onclick="location.href='#Url.Action(" RevokeAuth ","Settings ")'">
<img alt="Unlink Slack" height="30" width="30" style="padding-left:10px;" src="https://pbs.twimg.com/profile_images/885554951857946624/sd7GRyjY_400x400.jpg" /><input class="slkInp" type="button" value="Unlink Slack" onclick="location.href='#Url.Action("
RevokeAuth ","Settings ")'"/></div>
<a href="https://slack.com/oauth/authorize?scope=identity.basic,identity.email,identity.team,identity.avatar&client_id=373568302675.374024189699">
<img alt="Sign in with Slack" height="40" width="172" src="https://platform.slack-edge.com/img/sign_in_with_slack.png" srcset="https://platform.slack-edge.com/img/sign_in_with_slack.png 1x, https://platform.slack-edge.com/img/sign_in_with_slack#2x.png 2x"
/>
First off, I can't ask for clarification in a comment because of the 50 reputation requirement. Fair enough.
What it seems like you're asking is how do you want to style a button to look like the Slack button, but with only HTML? All they are doing here is using an <img> tag to throw a button on the screen. If you want to copy this behavior exactly, grab an image editor and draw a rounded rectangle with 1px black border, throw your icon on the right and some text on the left then follow the slack design:
<a href="https://linkhere.link">
<img alt="Sign in with X" height="40" width="172" src="image.png" />
</a>
If you want to be able to have a button styled similarly with just HTML and CSS you can do that too, with your input:
input {
height: 40px;
width: 172px;
border: 1px solid gray;
border-radius: 5px;
background-color: white;
content: url(image.png);
...
}
Then add your own image and move the text and image to your liking.

Underscore appears at end of images anchors

There is a problem with my code where tiny underscores appear on the bottom-right corner of my anchor image. I have no idea how to fix it. I've heard answerers form other similar questions saying you have to add a closing </a> tag at the end, but that doesn't seem to be the problem, as I already have those tags included in my code. I also don't remember adding underscores into my code on purpose, so I have no idea how it can be removed.
<!DOCTYPE html>
<html>
<head></head>
<body style="background-image: url(https://img.michaels.com/L6/3/IOGLO/852866719/201341423/10151236.jpg?fit=inside|1024:1024);">
<button onclick="executeCommand()" style="border: 0; background: 0;"><img src="https://image.flaticon.com/icons/svg/54/54527.svg" style="padding: 5px 0px 0px 0px; width: 40px; height: 40px;"></button><div id="search"></div>
<br>
<a href="https://www.google.ca/" target="_blank"><img src="https://storage.googleapis.com/gweb-uniblog-publish-prod/images/Chrome__logo.max-2800x2800.png" alt="Google Chrome" style="width: 40px; height: 40px; padding: 0px 0px 5px 4px">
</a>
<br>
<a href="https://mail.google.com/" target="_blank"><img src="https://storage.googleapis.com/gweb-uniblog-publish-prod/images/Gmail_logo.max-2800x2800.png" alt="Google Mail" style="width: 40px; height: 40px; padding: 5px 0px 5px 4px">
</a>
<br>
<a href="https://docs.google.com/" target="_blank"><img src="https://seeklogo.com/images/G/google-docs-logo-6A8CD4F30A-seeklogo.com.png" alt="Google Docs" style="width: 30px; height: 40px; padding: 5px 0px 5px 9px">
</a>
<br>
<a href="https://www.youtube.com/" target="_blank"><img src="https://lh3.googleusercontent.com/Ned_Tu_ge6GgJZ_lIO_5mieIEmjDpq9kfgD05wapmvzcInvT4qQMxhxq_hEazf8ZsqA=w300" alt="Youtube" style="width: 40px; height: 40px; padding: 5px 0px 5px 4px">
</a>
</body>
</html>
Add this CSS line
a{
text-decoration: none;
}
I had the same problem. this person, is the answer:
"Put the “a” tag directly after the “img” tag, i.e. get rid of the newline (which will be parsed as a space). – user3603486 Apr 1 '18 at 15:13"
see my example att: anchor underscores:

ebay style gallery issue

So I need help if this is even possible, going to try to be as detailed as possible so you guys understand my problem. I found a simple ebay style gallery code that I want to incorporate into my website i'm making. heres the code
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="width: 400px; vertical-align: top;">
<img src="1_large.jpg" width="398" height="299" alt="Large Photo" style="border: 1px solid #000000;" name="swap">
</td>
<td style="width: 6px;"></td>
<td style="width: 94px; vertical-align: top;">
<img src="1_small.jpg" width="92" height="69" alt="Small Photo" style="border: 1px solid #000000; margin-bottom: 3px;" onmousedown="document.swap.src='1_large.jpg';">
<br>
<img src="2_small.jpg" width="92" height="69" alt="Small Photo" style="border: 1px solid #000000; margin-bottom: 3px;" onmousedown="document.swap.src='2_large.jpg';">
<br>
<img src="3_small.jpg" width="92" height="69" alt="Small Photo" style="border: 1px solid #000000; margin-bottom: 3px;" onmousedown="document.swap.src='3_large.jpg';">
</td>
</tr>
</table>
I also have a slimbox2 addon into my site, link is here if anyone doesnt know what that is. slimbox2
so all i need to do is add this
<a href="images/1_large.jpg" rel="lightbox"><img src=........./>
to allow the image to expand into a larger preview using slimbox, my problem is, if i add it to main image that says "1_large.jpg" the href link is still linked to that specific image, regardless if I "swap" it when i click on another image
for example, i have 3 images in the gallery. the first image is already loaded into the big preview of the ebay style gallery, when i click on image 3, it gets swapped out to the big preview of the ebay style, now i want to expand it and see the image a lot bigger (this is where slimbox comes in) but once i click the big preview, the image gets expanded, but image 1 gets loaded, not image 3.
hopefully i made the problem clear, if anyone can help that would be fantastic!
all in all, im looking for a photo gallery similar to neweggs website for viewing products
Is this the functionality you're looking for? - FIDDLE
HTML
<div class='bigpic'></div>
<div class='rightbar'>
<div class='littlepic'><img src='http://img4.wikia.nocookie.net/__cb20130310121325/youtubepoop/images/c/c0/Goofy_Yop.jpg' /></div>
<div class='littlepic'>
<img src='http://img4.wikia.nocookie.net/__cb20130706024933/disney/images/8/88/Mickey-Mouse-High-Resolution-Wallpapers.stillmaza.com-1.jpg' /></div>
<div class='littlepic'><img src='http://images.wikia.com/disney/images/archive/7/71/20121205062928!Donald-duck-disney-photo-450x400-dcp-cpna013154.jpg' /></div>
</div>
CSS
.bigpic {
float: left;
width: 400px;
height: 300px;
border: 1px solid black;
overflow: hidden;
}
.bigpic img {
width: 400px;
height: 300px;
}
.rightbar {
float: left;
width: 110px;
margin-left: 5px;
}
.littlepic {
width: 100px;
height: 80px;
border: 1px solid black;
margin-bottom: 5px;
overflow: hidden;
}
.littlepic img {
width: 100%;
}
JS
$('.littlepic img').on('click', function(){
$('.bigpic').html('');
$(this).clone().appendTo('.bigpic');
});
Edit:
<script>
$(document).ready(function(){
$('.rightbar .littlepic:first-child img').clone().appendTo('.bigpic');
$('.littlepic img').on('click', function(){
$('.bigpic').html('');
$(this).clone().appendTo('.bigpic');
});//end click
});//end ready
</script>
</body>
</html>

Weird HTML behavior?

<a href='#' style='display: block; border: 1px solid black; width: 208px; height: 210px;'>
<a href='#'>My link</a>
</a>
Why is it that when I open this html in a browser, it shows me the 'My Link' button outside the box with the black border (that is another link) element?
The HTML is invalid. An a element may not contain another a element. You are seeing browser error recovery in action.
Given your code as input, the DOM generated in Chrome looks (when serialized back to HTML) like this:
<a href="#" style="display: block; border: 1px solid black; width: 208px; height: 210px;">
</a>My link
I don't have time to write tests to prove it, but I suspect the logic being used to recover is:
Second a element not allowed here
Close first a element prematurely so the second one is allowed
My Link
End of a element
End tag for a element that is not open: discard it
looks fine if you do this:
<div style="display: block; border: 1px solid black; width: 208px; height: 210px;">
My link
</div>

Suggestion for gallery thumbnail on click?

I'm trying to build an image gallery with thumbnails and a display for a larger image. At present, its working when the the mouse hovers over the thumbnail which displays the larger image. However I wish to replace the hover feature with an on click so that the larger image does not disappear when the mouse leaves the thumbnail. From a bit of research I'm lead to believe that this can not be done with css as with the hover feature and that I would need to include some script. As I'm new to web development after this I'm a bit lost and would appreciate some help. Below is the html code for the gallery container and the corresponding css code......where do I start from here?
Thanks
A
html code
<div class="gallerycontainer">
<a class="thumbnail" href="#thumb"><img src="images/gallery/1one/101.jpg" width="56px" height="80px" border="0" /><span><img src="images/gallery/1one/101.jpg" width="405px" height="585px"/></span></a>
<a class="thumbnail" href="#thumb"><img src="images/gallery/1one/102.jpg" width="56px" height="80px" border="0" /><span><img src="images/gallery/1one/102.jpg" width="405px" height="585px"/></span></a>
<a class="thumbnail" href="#thumb"><img src="images/gallery/1one/103.jpg" width="56px" height="80px" border="0" /><span><img src="images/gallery/1one/103.jpg" width="405px" height="585px"/></span></a>
<a class="thumbnail" href="#thumb"><img src="images/gallery/1one/104.jpg" width="56px" height="80px"border="0" /><span><img src="images/gallery/1one/104.jpg" width="405px" height="585px"/></span></a>
<br />
</div>
css code
.gallerycontainer{
position: absolute;
/*Add a height attribute and set to largest image's height to prevent overlaying*/
}
.thumbnail img{
border: 1px solid white;
margin: 0 5px 5px 0;
}
.thumbnail:hover{
background-color: transparent;
}
.thumbnail:hover img{
border: 1px solid grey;
}
.thumbnail span{ /*CSS for enlarged image*/
position: absolute;
background-color: #000000;
padding: 5px;
left: -1000px;
border: none;
visibility: hidden;
color: black;
text-decoration: none;
}
.thumbnail span img{ /*CSS for enlarged image*/
border-width: 0;
padding: 2px;
}
.thumbnail:hover span{ /*CSS for enlarged image*/
visibility: visible;
top: 0;
left: 300px; /*position where enlarged image should offset horizontally */
z-index: 50;
}
Heres a simple start with jquery.
http://jsfiddle.net/8GKXM/
$('.thumbnail').each(function(){
$(this).click(function() {
$('.thumbnail span').hide();
$(this).find('span').show('slow');
});
});
This is what the jquery says basically:
On every individual .thumbnail click:
hide .thumbnail span ( as in every span it finds )
then
find clicked .thumbnail's span and show that
I would probably move the bigger images into their own container though...
You can use jQuery along with blockUI plugin:
<div class="gallerycontainer">
<a class="thumbnail" href="#thumb" class="imgthumb"><img src="images/gallery
/1one/101.jpg" width="56px" height="80px" border="0" /></a>
<a class="thumbnail" href="#thumb" class="imgthumb"><img src="images/gallery
/1one/102.jpg" width="56px" height="80px" border="0" /></a>
</div>
And then you can use the window onload event to attach the onclick event to fire the large image with blockUI:
$(function(){
$(".imgthumb").onclick(function() {
$.blockUI({
message: "<div><img src=" + $(this + " > img").attr("src") + " width='405' height='585' /></div>";
css: { border: '1px solid grey'}
});
});
});