I'm struggling to add a transparent background to my button.
I know it's quite simple but I'm not sure what I'm doing wrong for it not to take effect.
The Html code I've written:
<div class="footer-text-cta">
<p>Want to know what equipment I use when I go kayaking?<button class="green-button">I want to know!</button></p>
</div>
My CSS code:
button.green-button{
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 7px 20px !important;
border-radius: 5px;
margin: 0px 0px 0px 20px;
background-color: #1ec279;
border: 3px solid #1ec279;
border-radius: 5px;
}
button.green-button a {
text-decoration: none;
color: #fff;
}
button.green-button a:hover{
background-color: transparent;
color: #1ec279;
}
I've added an image of what I'm trying to get the button to look like below.
Here you go with a nice transition XD
button.green-button{
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
padding: 7px 20px !important;
border-radius: 5px;
margin: 0px 0px 0px 20px;
background-color: #1ec279;
border: 3px solid #1ec279;
border-radius: 5px;
transition: 0.8s;
}
button.green-button a {
text-decoration: none;
color: #fff;
}
button.green-button:hover{
background-color: rgba(255,255,255,0);
cursor: pointer;
}
button.green-button:hover a{
color: #1ec279;
}
<div class="footer-text-cta">
<p>Want to know what equipment I use when I go kayaking?<button class="green-button">I want to know!</button></p>
</div>
The only trick to a button like this is that there is a border. I'm going to assume that on :hover you want the background to appear, as this seems to be the most common usage for these ghost or outline button styles.
That being the case your code might look something like this:
.button-example {
padding: 15px;
background: #000;
}
.button {
display: inline-block;
padding: 10px 15px;
font-family: Helvetica, Arial, sans-serif;
border: 3px solid #aaa;
border-radius: 6px;
cursor: pointer;
}
.button-green {
background: #1ec279;
border-color: #1ec279;
color: #fff;
}
.button-green.button-outline {
background: none;
}
.button-green:hover {
background: #19a969;
border-color: #19a969;
}
<div class="button-example">
<button class="button button-green">
I am a green button
</button>
<button class="button button-green button-outline">
I am a green outline button
</button>
<button class="button">
I am a sad, colorless button
</button>
</div>
Related
So since I have been trying so hard to make the h4 color change from #333333 to #ffffff while making the background change from #ffffff to #028041
here is a snippet of my code
.pnl-heading {
background: #F2F2F2;
border: 1px solid #BDBDBD;
box-sizing: border-box;
padding: 11px 43px 13px 43px;
}
.pnl-heading a {
font-size: 18px;
letter-spacing: 0.03em;
text-transform: capitalize;
color: #333333;
}
.pnl-default .pnl-heading:hover, .pnl-default .pnl-heading.active {background:#028041; color: #FFFFFF}
<div class="pnl-default">
<div class="pnl-heading active">
<h4 class="panel-title">
Group 1
</h4>
</div>
</div>
<div class="pnl-default">
<div class="pnl-heading">
<h4 class="panel-title">
Group 1
</h4>
</div>
</div>
Try this
#pnl-heading {
background: #F2F2F2;
border: 1px solid #BDBDBD;
box-sizing: border-box;
padding: 11px 43px 13px 43px;
}
#pnl-heading {
background: #028041;
border: 1px solid #BDBDBD;
box-sizing: border-box;
padding: 11px 43px 13px 43px;
}
#panel-title{
color: #FFFFFF;
}
#panel-title:hover {
color: #000000;
}
Hope this helps
Try this:
.pnl-heading:hover a{
color: fff;
}
.pnl-heading:hover {
background: #028041;
}
I add a blog sign up form to the sidebar of our blog page and styled it with CSS. It looks fine on desktop view, but when you open the page on a mobile phone then the button overlaps the bottom of the page;
https://screentimelabs.com/parenting-hacks/
enter image description here
Here's the code that I added to the style sheet;
.sidebar-widget #mc_embed_signup{
width: 278px;
height: 211px;
background: url(https://screentimelabs.com/wp-content/uploads/2015/10/bg_logo.png);
border: solid 1px silver;
box-shadow: 0px 3px 5px 1px silver;
}
.sidebar-widget #mc_embed_signup h2{
color: #ffffff;
font-family: "Sans Pro Regular", sans-serif;
font-size: 26px;
margin: 4px 0;
}
.sidebar-widget #mc_embed_signup .mc-field-group{
font-family: "Sans Pro Regular", sans-serif;
color: #ffffff;
}
.sidebar-widget #mc_embed_signup .mc-field-group{
font-family: "Sans Pro Regular", sans-serif;
color: #ffffff;
}
.sidebar-widget #mc_embed_signup input.button{
color: #FFFFFF;
border: 2px solid #FFFFFF;
background-color: #ffc23b;
text-transform: uppercase;
margin
}
Any help would be hugely appreciated, spent hours on this now.
You have to change this class like this,
.sidebar-widget #mc_embed_signup {
width: 278px;
height: auto;
background: url(https://screentimelabs.com/wp-content/uploads/2015/10/bg_logo.png) no-repeat;
background-size: cover;
border: solid 1px silver;
box-shadow: 0px 3px 5px 1px silver;
}
I am trying to make to simple buttons. Easy. However they will not for some reason round off the corners of the outline. This is what i have for my HTML and CSS
<a class="login-worker" href="">LOG IN AS A WORKER</a>
<a class="login-user" href="">LOG IN AS A USER</a>
.login-worker,
.login-user {
font-size: 22px;
font-weight: 600;
outline: 3px solid #000000;
margin: 5px;
text-decoration: none;
color: #000000;
padding: 20px;
padding-right:75px;
padding-left:75px;
position: relative;
border-radius: 5px;
background-color: #248FD4;
}
Use border: solid 2px #000; not outline.
Example here
.login-worker,
.login-user {
display: block;
font-size: 22px;
font-weight: 600;
border: solid 2px #000;
margin: 5px;
text-decoration: none;
color: #000000;
padding: 20px;
padding-right:75px;
padding-left:75px;
position: relative;
border-radius: 5px;
background-color: #248FD4;
}
The cause seems to be outline: 3px solid #000000;
Change to:
border: 3px solid #000000;
border-radius: 5px;
After all, your question states Why won't my **border** round off it's corners?
But if it's outline you need then please see Outline radius? (user289112 provided link but removed his answer)
I want to show a p tag or legend tag or any html text like button. But how is it possible? I have tried with css but not working well.
I want to show it like button.
<p class="button" >Submit</p>
or
<a class="button" >Submit</a>
or
<legend class="button" >Submit</legend>
Now need the button class.
Just apply css styles and cursor: pointer; to it to make it appear that it's a button
.button{
display: inline-block;
background: #000;
border-radius: 4px;
font-family: "arial-black";
font-size: 14px;
color: #FFF;
padding: 8px 12px;
cursor: pointer;
}
JSFIDDLE
It is simple with css.
<p class='btn'> Button 1 </p>
And Your CSS
.btn{
float:left;
width:auto;
height:30px;
display:block;
border:1px solid #ff6600;
background:#00ff00;
color:#000;
line-height:30px;
text-align:center;
padding:0 20px;
border-radius:3px;
}
.btn:hover{
cursor:pointer;
}
jsfiddle : http://jsfiddle.net/ob67xnw4/1/
Try This.
Here is the Working FIDDLE
CSS
.button {
width: 75px;
background: #d2d2d2;
text-align: center;
float: left;
color: #000;
line-height: 32px;
text-decoration: none;
}
.button: hover{
width: 75px;
background: #0e567f;
color: #fff;
text-align: center;
float: left;
line-height: 32px;
text-decoration: none;
}
<p class='button'> Submit </p>
.button{
background: -webkit-linear-gradient(top, #CCB5B6 20%, #274936 70%);
width: 100px;
height: 40px;
font-family: sans-serif;
font-size: 25px;
text-align: center;
line-height: 40px;
color: #96F256;
border-radius: 10px;
box-shadow: 0 2px 5px 3px black;
cursor: pointer;
}
.button:hover{
color: white;
}
OUTPUT
I think you should use this code and it is working well. You can change Color according to you.
Live Demo
HTML Code:
<input class="round-button-circle" type="submit" value="Submit"/>
CSS Code:
.round-button-circle {
width: 150px;
height:50px;
border-radius: 10px;
border:2px solid #cfdcec;
overflow:hidden;
font-weight: 15px;
background: #4679BD;
box-shadow: 0 0 3px gold;
}
.round-button-circle:hover {
background:#30588e;
}
Result:
Had just got what did I want.
DEMO JSFIDDLE
.button {
display: inline-block;
outline: none;
cursor: pointer;
border: solid 1px #da7c0c;
background: #478dad;
text-align: center;
text-decoration: none;
font: 14px/100% Arial, Helvetica, sans-serif;
padding: .5em 2em .55em;
text-shadow: 0 1px 1px rgba(0,0,0,.3);
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
border-radius: .3em;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.button:hover {
background: #f47c20;
background: -webkit-gradient(linear, left top, left bottom, from(#f88e11), to(#f06015));
background: -moz-linear-gradient(top, #f88e11, #f06015);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f88e11', endColorstr='#f06015');
}
.button:active {
position: relative;
top: 1px;
}
hopefully you can help with a simple question about CSS. I'm trying to make a button (doesn't need to be html class button) with a transparent background and an outline with text that does not have the same opacity as the button. That is, the text should remain at a different opacity than the button. Is this possible?
My attempt at a fiddle to solve this here - http://jsfiddle.net/9jXYt/
CSS:
#xxx {
outline:white solid 0.5px;
/*opacity: 0.2; */
background-color: rgba(255,0,0,0.2);
padding: 6px 8px;
border-radius: 3px;
color: black;
font-weight: bold;
border: none;
margin: 0;
/*box-shadow: 0px 2px 3px #444;*/
}
#xxx:hover {
opacity: 0.9;
}
#fff {
font-family: helvetica, arial, sans-serif;
font-size: 19pt;
opacity: 1 !important;
color: rgba(0,0,0,0.5) !important;
}
HTML:
<button id="xxx"><div id="fff">This is a test</div></button>
Thanks in advance for any hints.
opacity is inherited by children and can't be reversed, so use rgba on the parent as well. E.g.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
#xxx {
outline:white solid 0.5px;
padding: 6px 8px;
border-radius: 3px;
color:rgba(0,0,0,0.4);
font-weight: bold;
border: none;
margin: 0;
background: rgba(0,0,0,0.2);
font-family: helvetica, arial, sans-serif;
font-size: 19pt;
}
#xxx:hover {
background: rgba(0,0,0,0.4);
color:rgba(0,0,0,0.8);
}
</style>
</head>
<body>
<button id="xxx">This is a test</button>
</body>
</html>
I think the secret to what you're trying to do is to use transparent colors rather than opacity.
#xxx {
outline:white solid 0.5px;
padding: 6px 8px;
border-radius: 3px;
background-color: rgba(0,0,0, .25);
color: black;
font-weight: bold;
border: none;
margin: 0;
}
#xxx:hover {
background-color: rgba(0,0,0,.30);
}
#fff {
font-family: helvetica, arial, sans-serif;
font-size: 19pt;
color: rgba(0,0,0,.25);
}
#fff:hover {
color: rgba(0,0,0,.6);
}
I've adapted your fiddle: http://jsfiddle.net/harveyramer/8pymY/
#xxx:hover {
background-color: rgba(255,0,0,0.9);
}
By setting your opacity you are affecting everything in it.
As ralph.m said,
opacity is inherited by children and can't be reversed, so use rgba on the parent as well. In case you need an example, here is an edited jsfiddle.
http://jsfiddle.net/9jXYt/3/
Good luck!