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.
Related
I am trying to make a navbar, background, and style consistent through a few paged site. I have done a bit of research and found I might be able to use a server side include or the link property to embed a page in all the pages so I can change once and feel the effects on all the pages, I found the way to change the background is to add it to the body tag, but shouldn't the body tag be separate from the embedded file? I considered opening the body tag in the template file and closing it in each individual page, but that seems very bad.
Here is my unfinished template file.
<style>
body {
background-color: #afa7a7;
color: white;
}
.button {
background-color: #424242;
color: white;
border:none;
padding 15px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px; 2px;
cursor: pointer;
}
</style>
<body>
<a href="Main.shtml">
<img src="images/pentagram.png" alt="Pentagram" width="200px" height="200px" style="float: left;" />
</a>
<a href="Main.shtml">
<img src="images/pentagram.png" alt="Pentagram" width="200px" height="200px" style="float: right;" />
</a>
</body>
I wanted to make this linkable image to have a text in a pop up box (not the type of pop up that is on w3schools, I want a classic yellowish box) when I mouseover. I tried to do it like this
<div class="folder1">
<a href="yourlinkhere" target="_self" >
<img src="https://78.media.tumblr.com/c00202bad8ae39931e34a7efa861d18b/tumblr_p70bjja6xI1x5vw3ao1_500.png" height="46" width="57"
title="This is some text I want to display." </a>
</div>
Opening the page in the link works great but there is no pop up box when I hover on it. Any help?
Currently, you are setting the title attribute to get a tooltip type hint when the element is hovered over. If this is what you are looking to do but perhaps just style the textbox to be, say, yellow, I would suggest using the following:
a {
color: #900;
text-decoration: none;
}
a:hover {
color: red;
position: relative;
}
a[data]:hover:after {
content: attr(data);
padding: 4px 8px;
color: rgba(0,0,0,0.5);
position: absolute;
left: 0;
top: 100%;
white-space: nowrap;
z-index: 2;
border-radius: 5px ;
background: rgba(0,0,0,0.5); /*Change this to yellow, or whatever background color you desire*/
}
<a data="This is the CSS tooltip showing up when you mouse over the link"href="#" class="tip">Link</a>
The above code was provided by Peeyush Kushwaha in this post. Simply change the anchor tag to your image tag, and apply styles as you see fit.
If by 'popup' you are looking for an alert to the user that requires interaction to close, you can use window.alert('text') in javascript in conjunction with the onmouseover event handler.
<img src="some_image.png" height="46px" width="57px" onmouseover="window.alert('Some Message')"/>
Otherwise, if you are looking for another element to be displayed upon mouseover of the image, you can use a bit of javascript to display a div or paragraph (really anything) upon mouseover of the img.
function showDiv() {
document.getElementById('popupBox').style.display = 'block';
}
#popupBox {
display: none;
}
<img src="some_image.png" width="41px" height="57px" onmouseover="showDiv()"/>
<div id="popupBox">Some Popup Text</div>
You can do this simply with CSS, or you can use one of many simple 'tooltip' JavaScript options. Bootstrap for example has this tooltip functionality built-in, ready to use. If you want something basic, here's a simple CSS-only approach that you can customise to your needs:
<!-- padding added here so you can see the pop-up above the folder, not necessary in-page -->
<div class="folder1" style="padding: 200px;">
<a href="yourlinkhere" target="_self" class="popper">
<img src="https://78.media.tumblr.com/c00202bad8ae39931e34a7efa861d18b/tumblr_p70bjja6xI1x5vw3ao1_500.png" height="46" width="57" />
<span class="pop-up">This is some text I want to display.</span>
</a>
</div>
<style>
a.popper {
display: inline-block;
position: relative;
}
.pop-up {
display: none;
position: absolute;
left: 0;
bottom: 100%;
padding: 1rem 1.5rem;
background: yellow;
color: black;
}
a.popper:hover .pop-up,
a.popper:focus .pop-up {
display: block;
}
</style>
Basically, you position the a tag relatively so that it can have absolutely positioned children, then relying on a:hover you show / hide the child using the child element's display property.
You can equally try this using css pseudo-element
a{
position: relative;
}
a:hover:after{
display:block;
content: "This is some text I want to display";
width: 200px;
background: yellow;
position: absolute;
top:0;
padding: 20px;
}
<div class="folder1" style="margin: 70px">
<a href="yourlinkhere" target="_self" class="">
<img src="https://78.media.tumblr.com/c00202bad8ae39931e34a7efa861d18b/tumblr_p70bjja6xI1x5vw3ao1_500.png" height="46" width="57"
</a>
</div>
I want to make a buttons that looks like:
I tried this:
css:
button {
color: #900;
border: 1px solid #900;
font-weight: bold;
width: 200px;
height: 100px;
}
button img {
margin-right: 5px;
vertical-align: middle;
}
html:
<button class="btnExample" type="submit" value="Submit">
<img src="./images/img04.jpg" width="18" height="18" alt=""/>Submit</button>
And result:
Why image so small(18*18px)? How to make image bigger?
change this to increase size
<img src="./images/img04.jpg" width="28" height="28" alt=""/>Submit</button>
to change size change width=" " and for height=" "
button {
color: #900;
border: 1px solid #900;
font-weight: bold;
width: 200px;
height: 100px;
}
button img {
margin-right: 5px;
vertical-align: middle;
}
<button class="btnExample" type="submit" value="Submit">
<img src="http://4vector.com/i/free-vector-kuba-arrow-button-set-clip-art_117492_Kuba_Arrow_Button_Set_clip_art_hight.png" width="58" height="58" alt=""/>Submit</button>
The image is as big as you make it. From your comments, it seems that the actual size of the image is 18 by 18 pixels. I would be possible to stretch it by setting larger values for the width and height attributes or by setting the width and height properties to suitable values in CSS. However, scaling upwards may produce graphically poor results for raster images like jpeg images.
It is therefore better to use a graphics program to create the image in the desired size and change the width and height attributes to match the new size.
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>
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'}
});
});
});