adding icon to link/button - css

I currently have a link and I'm using it as a button look to it and I would like to add an icon to it.
Example: a plus sign + icon next to a word that will say Add User. Here is my link:
<a class="glossyBtn" href='<%:Url.Action("Edit", "Case", new{caseId = Model}) %>'>Cancel</a>
Here is my .glossyBtn style:
.glossyBtn
{
display: inline-block;
background-color: #c1e2f4;
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #eeeeee), color-stop(100%, #cccccc));
background-image: -webkit-linear-gradient(top, #eeeeee, #b1daf1);
background-image: -moz-linear-gradient(top, #eeeeee, #b1daf1);
background-image: -ms-linear-gradient(top, #eeeeee, #b1daf1);
background-image: -o-linear-gradient(top, #eeeeee, #b1daf1);
background-image: linear-gradient(top, #eeeeee, #b1daf1);
border: 1px solid #3e95c8;
border-bottom: 1px solid #3e95c8 !Important;
border-radius: 3px;
color: #046fad !Important;
font: bold 12px Helvetica Neue, Helvetica, Arial, sans-serif;
padding: 5px 12px;
text-align: center;
text-shadow: 0 1px 0 #eee;
text-decoration: none;
cursor: pointer;
list-style: none;
float: left;
margin-top: 5px;
margin-right: 5px;
}
Live demo: Tinkerbin

I haven't tested this, but the following should work with proper positioning:
<a class="glossyBtn" href='<%:Url.Action("Edit", "Case", new{caseId = Model}) %>'><span><img src="plus.png" alt=""></span>Cancel</a>
By prefixing the text with a <span> containing an <img>, you can insure the image stays inline with the text on the right.

Use the :after pseudo-selector:
.glossyBtn:after {
content: '+';
padding-left: 5px;
}
Live demo: Tinkerbin
If you want to add the plus character before the text, use :before pseudo-selector:
.glossyBtn:before {
content: '+';
padding-right: 5px;
}
Live demo: Tinkerbin
I've added padding left/right, to make some space between the text and the plus character.

Related

I want to move links from bottom of sidebar to top

I created a sidebar in Google Sheets using an online template. It is working perfectly, but the buttons to update and reset are on the bottom, and I would like them on top of the sidebar list.
I have tried altering the button code in terms of height and other factors but cannot seem to get it to be agreeable.
This is where I believe the code needs to be altered:
.button,
button,
input[type="button"],
input[type="image"],
input[type="reset"],
input[type="submit"] {
background: -moz-linear-gradient(top, #f5f5f5, #f1f1f1);
background: -ms-linear-gradient(top, #f5f5f5, #f1f1f1);
background: -o-linear-gradient(top, #f5f5f5, #f1f1f1);
background: -webkit-linear-gradient(top, #f5f5f5, #f1f1f1);
background: linear-gradient(top, #f5f5f5, #f1f1f1);
border: 1px solid #dcdcdc;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
color: #333;
cursor: default;
font-family: arial, sans-serif;
font-size: 11px;
font-weight: bold;
height: 29px;
line-height: 27px;
margin: 0;
min-width: 72px;
outline: 0;
padding: 0 8px;
text-align: center;
white-space: nowrap;
}
<body>
<div class="container"></div>
<div class="buttons">
<p>
<button class="action" id="action">Add Rejections</button>
<button id="btn">Reset List</button>
</p>
</div>
I would ultimately like the two buttons to be on top of the sidebar list instead of having to scroll to the bottom. Any help would be appreciated.

How to position buttons in exactly same line

I created two buttons. My intention is to set them in exact same line as buttons at the left side. As U can see at my attachement, delete button is scrolled up one line. Any ideas how to achieve my intention?
Here are CSS rlues for yellow button:
.button-own_I {
float:right;
display: inline-block;
text-align: center;
vertical-align: middle;
padding: 7px 6px;
border: 1px solid #a12727;
border-radius: 8px;
background: #ffff4a;
background: -webkit-gradient(linear, left top, left bottom, from(#ffff4a), to(#998f26));
background: -moz-linear-gradient(top, #ffff4a, #998f26);
background: linear-gradient(to bottom, #ffff4a, #998f26);
text-shadow: #591717 1px 1px 1px;
font: normal normal bold 11px arial;
color: #ffffff;
text-decoration: none;
margin:5px;
}
.button-own_I:hover,
.button-own_I:focus {
background: #ffff59;
background: -webkit-gradient(linear, left top, left bottom, from(#ffff59), to(#b8ac2e));
background: -moz-linear-gradient(top, #ffff59, #b8ac2e);
background: linear-gradient(to bottom, #ffff59, #b8ac2e);
color: #ffffff;
text-decoration: none;
}
.button-own_I:active {
background: #99992c;
background: -webkit-gradient(linear, left top, left bottom, from(#99992c), to(#998f26));
background: -moz-linear-gradient(top, #99992c, #998f26);
background: linear-gradient(to bottom, #99992c, #998f26);
}
Here are CSS rules for red button:
.buttonDelete {
float:right;
display: inline-block;
text-align: center;
vertical-align: middle;
padding: 8px 12px;
border: 1px solid #a12727;
border-radius: 8px;
background: #ff4a4a;
background: -webkit-gradient(linear, left top, left bottom, from(#ff4a4a), to(#992727));
background: -moz-linear-gradient(top, #ff4a4a, #992727);
background: linear-gradient(to bottom, #ff4a4a, #992727);
text-shadow: #591717 1px 1px 1px;
font: normal normal bold 11px arial;
color: #ffffff;
text-decoration: none;
}
.buttonDelete:hover,
.buttonDelete:focus {
background: #ff5959;
background: -webkit-gradient(linear, left top, left bottom, from(#ff5959), to(#b62f2f));
background: -moz-linear-gradient(top, #ff5959, #b62f2f);
background: linear-gradient(to bottom, #ff5959, #b62f2f);
color: #ffffff;
text-decoration: none;
}
.buttonDelete:active {
background: #982727;
background: -webkit-gradient(linear, left top, left bottom, from(#982727), to(#982727));
background: -moz-linear-gradient(top, #982727, #982727);
background: linear-gradient(to bottom, #982727, #982727);
}
ABCDEFGHIJKLMONOPQRSTUVWXYZ
The yellow button has a margin at the end, the other don't. If you remove the margin from the yellow, or add margin to the red one your problem will be solved
Here's a pen showing it working:
https://codepen.io/anon/pen/xWWZdo
.button-own_I {
float: right;
display: inline-block;
text-align: center;
vertical-align: middle;
padding: 7px 6px;
border: 1px solid #a12727;
border-radius: 8px;
background: #ffff4a;
background: -webkit-gradient(linear, left top, left bottom, from(#ffff4a), to(#998f26));
background: -moz-linear-gradient(top, #ffff4a, #998f26);
background: linear-gradient(to bottom, #ffff4a, #998f26);
text-shadow: #591717 1px 1px 1px;
font: normal normal bold 11px arial;
color: #ffffff;
/* --- HERE -- */
text-decoration: none;
margin:5px;
}
.buttonDelete {
float:right;
display: inline-block;
text-align: center;
vertical-align: middle;
padding: 8px 12px;
border: 1px solid #a12727;
border-radius: 8px;
background: #ff4a4a;
background: -webkit-gradient(linear, left top, left bottom, from(#ff4a4a), to(#992727));
background: -moz-linear-gradient(top, #ff4a4a, #992727);
background: linear-gradient(to bottom, #ff4a4a, #992727);
text-shadow: #591717 1px 1px 1px;
font: normal normal bold 11px arial;
color: #ffffff;
/* --- AND HERE -- */
text-decoration: none;
margin:5px;
}

How to apply css style to popup title element of label

I have a form label as follows:
<label id="jform_email-lbl" for="jform_email" class="hasTip required"
title="Email Address::Please enter the email address associated with your User
account.<br />A verification code will be sent to you. Once you have
received the verification code, you will be able to choose a new password for
your account.">Email Address:<span class="star"> *</span></label>
I want to apply a different style to my popover 'title' element (#000).
Not the 'Email Address:' label that shows on the form (which is #fff).
Thought I may be able to do the following, but it doesn't work:
label#jform_email-lbl[type="title"] {
color: #000;
}
****EDITED**
The answer is as follows - for anyone else trying to find the right css:**
div.tip .tip-title {
color: #E77600 !important;
font-weight: bold;
}
div.tip .tip-text {
color: #979797 !important;
font-weight: bold;
}
Later edit, i understood the question :
<!DOCTYPE html>
<html>
<head>
<style>
label {
color: #900;
text-decoration: none;
}
label:hover {
color: red;
position: relative;
}
label[title]:hover:after {
content: attr(title);
padding: 4px 8px;
color: red;
position: absolute;
left: 0;
top: 100%;
white-space: nowrap;
z-index: 20px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: 0px 0px 4px #222;
-webkit-box-shadow: 0px 0px 4px #222;
box-shadow: 0px 0px 4px #222;
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #eeeeee),color-stop(1, #cccccc));
background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
}
</style>
</head>
<label id="jform_email-lbl" for="jform_email" class="hasTip required" title="something">Email Address:<span class="star"> *</span></label>
</html>

Text of link will only show if my mouse hovers over link area, not anywhere in whole button

I don't know if I'll successfully convey what I mean but here goes. I have some CSS and am trying to get the text label of a link in a navigation to button to show if I hover anywhere over that button, not just over where the link should display. What happens is when I hover over most of the button, the button goes all-white. I want it to be white background, but show the text. Make sense?
Just try something as below:
CSS:
.CSSButton {
border: 1px solid #D1D1D1;
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.1, #FFFFFF), color-stop(0.9, #D1D1D1) );
background: -moz-linear-gradient( center top, #FFFFFF 10%, #D1D1D1 90% );
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFF', endColorstr='#D1D1D1');
background-color: #FFFFFF;
-moz-box-shadow: inset 0px 1px 2px 0px #FFFFFF;
-webkit-box-shadow: inset 0px 1px 2px 0px #FFFFFF;
box-shadow: inset 0px 1px 2px 0px #FFFFFF;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
text-shadow: 1px 1px 2px #FFFFFF;
font-weight: bold;
margin: 5px 5px;
padding: 6px 6px;
color: #999999;
letter-spacing: 1px;
font-family: 'Arial', sans-serif;
font-size: 16px;
width: 150px;
text-transform: capitalize;
text-align: center;
text-decoration: none;
cursor: pointer;
display: inline-block;
}
.CSSButton:hover {
background: -webkit-gradient( linear, left top, left bottom, color-stop(0.1, #D1D1D1), color-stop(0.9, #FFFFFF) );
background: -moz-linear-gradient( center top, #D1D1D1 10%, #FFFFFF 90% );
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#D1D1D1', endColorstr='#FFFFFF');
background-color: #D1D1D1;
}
.CSSButton:active {
position: relative;
top: 1px;
left: 0px;
}
HTML:
<span class="CSSButton">Click Me!</span>

Google Chrome shows space between <buttons>

I have problem with CSS <buttons> in Google Chrome, it shows space between <buttons>, but in Opera and IE it is OK, why?
Here is the full CSS code:
button {
border: 1px solid #bdbdbd;
text-shadow: 0 1px 1px white;
font: bold 11px Sans-Serif;
padding: 6px 8px;
white-space: nowrap;
vertical-align: middle;
color: #666;
background: -webkit-linear-gradient(top, white, #E0E0E0);
background: -moz-linear-gradient(top, white, #E0E0E0);
background: -ms-linear-gradient(top, white, #E0E0E0);
background: -o-linear-gradient(top, white, #E0E0E0);
cursor: pointer;
text-decoration: none;
margin-right: -1px;
}
Here is HTML code:
<div><button type="button">Send</button><button type="button">Reset</button></div>
Thanks for help.
Each set of buttons is contained within a div which has a margin-left of three (3) pixels.
EDIT Chrome also applies a default margin of one (1) pixel. You need to set the margin to zero (0) for the buttons to get rid of this spacing.
Seems to be a left margin as well. This corrects it in Chrome (not sure what it'll do in other browsers)... I edited the margin property.
button {
border: 1px solid #bdbdbd;
text-shadow: 0 1px 1px white;
font: bold 11px Sans-Serif;
padding: 6px 8px;
white-space: nowrap;
vertical-align: middle;
color: #666;
background: -webkit-linear-gradient(top, white, #E0E0E0);
background: -moz-linear-gradient(top, white, #E0E0E0);
background: -ms-linear-gradient(top, white, #E0E0E0);
background: -o-linear-gradient(top, white, #E0E0E0);
cursor: pointer;
text-decoration: none;
margin: 0 -1px 0 0;
}

Resources