CSS: create material design shadow issue - html

I need to create this button with CSS only and have an issue with box shadow. There are two different shadows on this button: one yellow, one black. The maximum what I get is this
.button {
height: 81px;
width: 250px;
text-align: center;
font-family: 'Celias_Medium', 'Open Sans:500', sans-serif;
font-size: 11px;
line-height: 3.3;
letter-spacing: 0.4px;
cursor: pointer;
outline: none;
display: block;
vertical-align: top;
padding: 23px 0 26px 0;
text-transform: uppercase;
color: #000000;
background-color: #fbfb5c;
box-shadow: 0 20px 90px -30px rgba(251, 251, 92, 0.9), 0 40px 90px -50px rgba(0, 0, 0, 0.5)
}
<div class="button">ADD 7 Activities</div>
Here is result. Is there any other solution to get this result?

try on this if u cant see it on chrome moz or safari
.button {
height: 81px;
width: 250px;
text-align: center;
font-family: 'Celias_Medium', 'Open Sans:500', sans-serif;
font-size: 11px;
line-height: 3.3;
letter-spacing: 0.4px;
cursor: pointer;
outline: none;
display: block;
vertical-align: top;
padding: 23px 0 26px 0;
text-transform: uppercase;
color: #000000;
background-color: #fbfb5c;
box-shadow: 0 20px 90px -30px rgba(251, 251, 92, 0.9), 0 40px 90px -50px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0 20px 90px -30px rgba(251, 251, 92, 0.9), 0 40px 90px -50px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: 0 20px 90px -30px rgba(251, 251, 92, 0.9), 0 40px 90px -50px rgba(0, 0, 0, 0.5);
}
hope this one works :)

Is that what you want?
.button {
height: 81px;
width: 250px;
text-align: center;
font-family: 'Celias_Medium', 'Open Sans:500', sans-serif;
font-size: 11px;
line-height: 3.3;
letter-spacing: 0.4px;
cursor: pointer;
outline: none;
display: block;
vertical-align: top;
padding: 23px 0 26px 0;
box-sizing: border-box;
text-transform: uppercase;
color: #000000;
background-color: #fbfb5c;
box-shadow: 1px 1px 70px -24px;
}
<div class="button">
ADD y activities
</div>

Generally speaking material buttons would look something like this, but I don't really know what you're asking.
.button {
height: 81px;
width: 250px;
text-align: center;
font-family: Celias_Medium, 'Open Sans:500', sans-serif;
font-size: 11px;
line-height: 3.3;
letter-spacing: .4px;
cursor: pointer;
vertical-align: top;
padding: 23px 0 26px;
box-sizing: border-box;
text-transform: uppercase;
background-color: #fbfb5c;
border-radius: 4px;
margin: 16px 0;
box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .24);
transition: all .3s cubic-bezier(.25, .8, .25, 1)
}
.button:hover {
box-shadow: 0 14px 28px rgba(0, 0, 0, .25), 0 10px 10px rgba(0, 0, 0, .22)
}
<div class="button">
Button no. 1
</div>
<div class="button">
Button no. 2
</div>
<div class="button">
Button no. 3
</div>
<div class="button">
Button no. 4
</div>
<div class="button">
Button no. 5
</div>

Related

Align a button and input

I am new to this, so as practice I tried to create a replica of the Netflix registration page.
I am using the flex box model on the webpage.
I am struggling to get the email input and the get started button to align. I have tried changing the button tag to an anchor tag and go the same result. I have tried using margin and padding on the individual elements and that didn't work.
.landing_page_block {
display: block;
width: 40%;
margin-top: 220px;
text-align: center;
}
.landing_page_h1 {
font-size: 65px;
font-weight: 700;
letter-spacing: 1.2px;
text-shadow: 5px 5px 15px 5px rgba(0,0,0,0.8);
-webkit-text-shadow: 5px 5px 15px 5px rgba(0,0,0,0.8);
}
.landing_page_phrase {
margin: 20px 0 30px 0;
font-weight: 300;
letter-spacing: 1.2px;
text-shadow: 5px 5px 15px 5px rgba(0,0,0,0.8);
-webkit-text-shadow: 5px 5px 15px 5px rgba(0,0,0,0.8);
}
.lp_box1 h5 {
letter-spacing: 1.1px;
font-weight: 300;
margin-bottom: 20px;
}
.lp-box2 {
height: 70px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.lp_box2 input {
width: 60%;
height: 70px;
border: none;
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
font-weight: 300;
padding-left: 15px;
-webkit-box-shadow: 0px 0px 24px 0px rgba(255,255,255,0.81) inset;
-moz-box-shadow: 0px 0px 24px 0px rgba(255,255,255,0.81) inset;
box-shadow: 0px 0px 24px 0px rgba(255,255,255,0.81) inset;
}
.get_started_btn {
height: 70px;
margin-left: -3px;
width: 39%;
font-size: 30px;
border: none;
border-left: 2px solid grey;
font-weight: 300;
color: white;
background-color: red;
text-decoration: none;
}
<div class="landing_page">
<div class="landing_page_block">
<div class="lp_box1">
<h1 class="landing_page_h1">Unlimited films, TV programmes and more.</h1>
<h3 class="landing_page_phrase">Watch anywhere. Cancel at any time.</h3>
<h6>Ready to watch? Enter your email to create or restart your membership.</h6>
</div>
<div class="lp_box2">
<input type="email" name="email" placeholder="Email address"/>
<button class="get_started_btn">Get Started </button>
</div>
</div>
</div>
The result of my code
I hope that's how you wanted your alignment to be
.landing_page_block {
margin-top: 220px;
text-align: center;
}
.landing_page_h1 {
font-size: 65px;
font-weight: 700;
letter-spacing: 1.2px;
text-shadow: 5px 5px 15px 5px rgba(0, 0, 0, 0.8);
-webkit-text-shadow: 5px 5px 15px 5px rgba(0, 0, 0, 0.8);
}
.landing_page_phrase {
font-weight: 300;
letter-spacing: 1.2px;
text-shadow: 5px 5px 15px 5px rgba(0, 0, 0, 0.8);
-webkit-text-shadow: 5px 5px 15px 5px rgba(0, 0, 0, 0.8);
}
.lp_box1 h5 {
letter-spacing: 1.1px;
font-weight: 300;
margin-bottom: 20px;
}
.lp_box2 {
display: flex;
align-items: center;
justify-content: space-around;
}
.lp_box2>.input-div{
height: 70px;
width: 62%;
}
.lp_box2>.input-div>input {
height: 70px;
width: 100%;
border: none;
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
font-weight: 300;
padding-left: 15px;
-webkit-box-shadow: 0px 0px 24px 0px rgba(255, 255, 255, 0.81) inset;
-moz-box-shadow: 0px 0px 24px 0px rgba(255, 255, 255, 0.81) inset;
box-shadow: 0px 0px 24px 0px rgba(255, 255, 255, 0.81) inset;
}
.get_started_btn {
height: 70px;
width: 30%;
font-size: 30px;
border: none;
border-left: 2px solid grey;
font-weight: 300;
color: white;
background-color: red;
text-decoration: none;
display: flex;
align-items: center;
justify-content: center;
}
<div class="landing_page">
<div class="landing_page_block">
<div class="lp_box1">
<h1 class="landing_page_h1">Unlimited films, TV programmes and more.</h1>
<h3 class="landing_page_phrase">Watch anywhere. Cancel at any time.</h3>
<h6>Ready to watch? Enter your email to create or restart your membership.</h6>
</div>
<div class="lp_box2">
<div class="input-div">
<input type="email" name="email" placeholder="Email address" />
</div>
<div class="get_started_btn">Get Started </div>
</div>
</div>
</div>

Position div relative height to parent

I'm trying to get the Log in text to be positioned at 33% height from the parent Card-Header-Background, but instead it looks like the height is being applied to the overall card.
.Account-Details-Card-Background {
width: 780px;
height: 600px;
border-radius: 18px;
box-shadow: 0 7px 70px 0 rgba(90, 97, 105, 0.1), 0 10px 10px 0 rgba(90, 97, 105, 0.06), 0 4px 8px 0 rgba(90, 97, 105, 0.12), 0 2px 0 0 rgba(90, 97, 105, 0.11);
background-color: #ffffff;
}
.Card-Header-Background {
width: 780px;
height: 69.6px;
border-radius: 18px;
box-shadow: 0 1px 0 0 #e0e2e8, 0 -1px 0 0 #e0e2e8;
background-color: #ffffff;
}
.Label---Log-in {
width: 61px;
height: 24px;
font-family: SFProText;
font-size: 20px;
font-weight: 500;
font-style: normal;
font-stretch: normal;
line-height: normal;
letter-spacing: -0.5px;
text-align: center;
color: #3c5071;
}
<div class="Account-Details-Card-Background" style="margin: 17.6vh 22.9vw; position: absolute">
<div class="Card-Header-Background">
<div>
<div class="Label---Log-in text" style="margin: 33% 45%; position: absolute;">
Log in
</div>
</div>
</div>
</div>
(codepen)
First of all, don't use inline style if you don't have to.
To achieve what you want you can just use top: 33% as I did here: https://codepen.io/anon/pen/QYOdRB
Please let me know if that's what you need.
It seems obvious now, but what I needed was padding not margin.

CSS Button and Image Behind

Sorry there isn't more code on this. I am new and stumped to be honest.
I have a CSS Button I am using on my webpage, code below. I'd like to put an image around the button like below... Slightly off center,behind the button itself, and which is mobile responsive.
.redbutton {
display: inline-block;
outline: none;
cursor: pointer;
margin: 10px auto 10px auto;
padding: 15px 6px 15px 6px;
font-size: 27px;
font-weight: 700;
text-align: center;
text-transform: uppercase;
cursor: pointer;
cursor: hand;
text-decoration: none;
text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
border-radius: .5em;
-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);
color: #faddde;
border: solid 1px #980c10;
background: #d81b21;
background: -webkit-gradient(linear, left top, left bottom, from(#ed1c24), to(#aa1317));
background: -moz-linear-gradient(top, #ed1c24, #aa1317);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ed1c24', endColorstr='#aa1317');
}
.largebuttonwidthC {
width: 60%;
}
<div class="redbutton largebuttonwidthC">SHOW ME HOW</div>
The circle image is here:
And I'd like it to look like this:
However, I cannot seem to figure out how to do this.
Thanks,
Alex
.contain {
background: url(https://i.stack.imgur.com/Nb7M7.png);
background-repeat: no-repeat;
width: 60%;
background-size: cover;
}
.redbutton {
display: inline-block;
outline: none;
cursor: pointer;
margin: 10px auto 10px auto;
padding: 15px 6px 15px 6px;
font-size: 27px;
font-weight: 700;
text-align: center;
text-transform: uppercase;
cursor: pointer;
cursor: hand;
text-decoration: none;
text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
border-radius: .5em;
-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);
color: #faddde;
border: solid 1px #980c10;
background: #d81b21;
background: -webkit-gradient(linear, left top, left bottom, from(#ed1c24), to(#aa1317));
background: -moz-linear-gradient(top, #ed1c24, #aa1317);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ed1c24', endColorstr='#aa1317');
}
.largebuttonwidthC {
width: 60%;
margin-left: 50%;
transform: translateX(-50%);
}
<div class="contain">
<div class="redbutton largebuttonwidthC">SHOW ME HOW</div>
</div>
First, you should clean your CSS and optimize it by not duplicating arguments such as "cursor: pointer", which you ca find two times in the code, also the "outline: none" should only be when the button is focused or active.
Either way, to put an image in the background you should do something similar to :
<button class="my_button" type="">My amazing button</button>
.my_button {
/*height, width, color...*/
background-image: url(img/my_img.png);
/* You can even move the image in the background to better suit your needs*/
background-position-y:-50px; /* Move the image on the Y axes*/
background-position-x: 10px; /* Move the image on the X axes*/
background-size: cover;
}
Try to something like this.
.redbutton {
display: inline-block;
outline: none;
cursor: pointer;
margin: 10px auto 10px auto;
padding: 15px 6px 15px 6px;
font-size: 16px;
font-weight: 700;
text-align: center;
text-transform: uppercase;
cursor: pointer; cursor: hand;
text-decoration: none;
text-shadow: 0 1px 1px rgba(0,0,0,.3);
background: url(https://i.stack.imgur.com/Nb7M7.png) no-repeat;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ed1c24', endColorstr='#aa1317');
}
.largebuttonwidthC{
width: 535px;
min-height:150px;
}
.redbutton p{
background-color: yellow;
height: 35px;
border: 1px solid yellow;
width: 470px;
padding-top: 10px;
}
<div class="redbutton largebuttonwidthC">
<p>Click Here to instantly Download this file</p>
</div>
Not perfect but I guess you will see the idea behind: See this fiddle
.redbutton {
display: inline-block;
z-index: 10;
position: relative;
outline: none;
cursor: pointer;
margin: 0 50px;
padding: 15px 6px 15px 6px;
font-size: 27px;
font-weight: 700;
text-align: center;
text-transform: uppercase;
cursor: pointer;
cursor: hand;
text-decoration: none;
text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
border-radius: .5em;
-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);
color: #faddde;
border: solid 1px #980c10;
background: #d81b21;
background: -webkit-gradient(linear, left top, left bottom, from(#ed1c24), to(#aa1317));
background: -moz-linear-gradient(top, #ed1c24, #aa1317);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ed1c24', endColorstr='#aa1317');
}
.largebuttonwidthC {
width: 300px;
}
.container {
position: relative;
margin: 50px;
}
.image {
content: "";
position: absolute;
left: -40px;
right: 0;
bottom: 0;
top: -30px;
background: url('https://i.stack.imgur.com/Nb7M7.png') no-repeat;
z-index: 0;
width: 512px;
height: 90px;
}
<div class="container">
<div class="redbutton largebuttonwidthC">SHOW ME HOW</div>
<span class="image"></span>
</div>
https://jsfiddle.net/nf7b2zx1/
.redbutton {
display: inline-block;
outline: none;
cursor: pointer;
margin: 10px auto 10px auto;
padding: 15px 6px 15px 6px;
font-size: 27px;
font-weight: 700;
text-align: center;
text-transform: uppercase;
cursor: pointer;
cursor: hand;
text-decoration: none;
text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
;
color: #faddde;
background: #d81b21;
background: url(https://i.stack.imgur.com/Nb7M7.png) no-repeat;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ed1c24', endColorstr='#aa1317');
}
.largebuttonwidthC {
width: 100%;
min-height: 70px
}
<div class="redbutton largebuttonwidthC">IAM TEXT</div>
change the buttons background to that blue circle
background-image: url(you img here...);
With a bit of CSS you can get something similar
.redbutton:before {
content: '';
position:absolute;
left:-20px;
right:-20px;
top:-20px;
bottom:-20px;
background-image: url('https://i.stack.imgur.com/Nb7M7.png');
background-size: 100% 100%;
}

CSS Button not rendering correctly on iPad

I have a button created with css on a web application, when I test the button on chrome on android the button renders fine and stays on top of everything because of the z-index property:
But when I test the same thing on chrome on IOS it doesnt renders the button the way its supposed to be and doesnt respect the z-index property:
I tried to add "-webkit-appearance: none;" to the css but it didnt worked heres the css and html:
#PINPOINT {
-webkit-appearance: none;
width: 70px;
height: 70px;
margin: 15px auto;
position: relative;
z-index: 5000;
}
#BUTTON {
-webkit-appearance: none;
box-sizing: border-box;
color: rgba(0, 0, 0, 0.870588);
height: 70px;
text-align: left;
width: 70px;
column-rule-color: rgba(0, 0, 0, 0.870588);
perspective-origin: 227.828px 35px;
transform-origin: 227.828px 35px;
border: 0px none rgba(0, 0, 0, 0.870588);
font: normal normal normal normal 14px / 21px Roboto, sans-serif;
outline: rgba(0, 0, 0, 0.870588) none 0px;
position: fixed;
right: 0;
}
#TEXT {
-webkit-appearance: none;
bottom: 0px;
box-shadow: rgba(0, 0, 0, 0.156863) 0px 2px 5px 0px, rgba(0, 0, 0, 0.117647) 0px 2px 10px 0px;
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
display: inline-block;
height: 55.5px;
left: 0px;
letter-spacing: 0.5px;
position: relative;
right: 0px;
text-align: center;
text-decoration: none;
text-transform: uppercase;
top: 0px;
vertical-align: middle;
width: 55.5px;
will-change: opacity, transform;
z-index: 1;
column-rule-color: rgb(255, 255, 255);
perspective-origin: 27.75px 27.75px;
transform-origin: 27.75px 27.75px;
background: rgb(239, 83, 80) none repeat scroll 0% 0% / auto padding-box border-box;
border: 0px none rgb(255, 255, 255);
border-radius: 50% 50% 50% 50%;
font: normal normal normal normal 14px / 56px Roboto, sans-serif;
margin: 0px 0px 14px;
outline: rgb(255, 255, 255) none 0px;
overflow: hidden;
transition: all 0.3s ease-out 0s;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"/>
<div id="PINPOINT">
<div id="BUTTON">
<i class="fa fa-reply" aria-hidden="true"></i>
</div>
</div>
You may use flexbox to make them align horizontally and vertically center. Here's the code.
#PINPOINT {
-webkit-appearance: none;
width: 70px;
height: 70px;
margin: 15px auto;
position: relative;
z-index: 5000;
}
#BUTTON {
-webkit-appearance: none;
box-sizing: border-box;
color: rgba(0, 0, 0, 0.870588);
height: 70px;
text-align: left;
width: 70px;
column-rule-color: rgba(0, 0, 0, 0.870588);
perspective-origin: 227.828px 35px;
transform-origin: 227.828px 35px;
border: 0px none rgba(0, 0, 0, 0.870588);
font: normal normal normal normal 14px / 21px Roboto, sans-serif;
outline: rgba(0, 0, 0, 0.870588) none 0px;
position: fixed;
right: 0;
}
#TEXT {
-webkit-appearance: none;
box-shadow: rgba(0, 0, 0, 0.156863) 0px 2px 5px 0px, rgba(0, 0, 0, 0.117647) 0px 2px 10px 0px;
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
height: 55.5px;
letter-spacing: 0.5px;
position: relative;
text-align: center;
text-decoration: none;
text-transform: uppercase;
vertical-align: middle;
width: 55.5px;
will-change: opacity, transform;
z-index: 1;
transform-origin: 27.75px 27.75px;
background: rgb(239, 83, 80) none repeat scroll 0% 0% / auto padding-box border-box;
border: 0px none rgb(255, 255, 255);
border-radius: 50% 50% 50% 50%;
font: normal normal normal normal 14px / 56px Roboto, sans-serif;
margin: 0px 0px 14px;
outline: rgb(255, 255, 255) none 0px;
overflow: hidden;
transition: all 0.3s ease-out 0s;
/*Use flexbox property to fix this.*/
display: flex;
justify-content: center;
align-items:center;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
<div id="PINPOINT">
<div id="BUTTON">
<i class="fa fa-reply" aria-hidden="true"></i>
</div>
</div>

CSS: center elements inside <div> side by side

i've been trying all night to center this elements without having them stacked on each other:
I've tried floating them to the left it works, but, they stick to the left side no matter what i did.
HTML:
<div class="center pages clearfix">
<buuton class="center page-number">1</buuton>
<buuton class="center page-number">2</buuton>
<buuton class="center page-number">3</buuton>
</div>
CSS:
.center {
margin-left: auto;
margin-right: auto;
}
.page-number {
display: block;
float: none;
width: 28px;
height: auto;
border-radius: 3px;
background-color: rgba(0, 0, 0, 0.47);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.34);
text-shadow: 0 2px 5px rgba(0, 0, 0, .5);
font-weight: 400;
line-height: 1.5;
text-align: center;
color: rgba(255, 255, 255, 0.47);
}
just update "display:block" to "display:inline-block" like the below updated css
updated css
.center {
margin-left: auto;
margin-right: auto;
text-align:center;
}
.page-number {
display: inline-block;
float: none;
width: 28px;
height: auto;
border-radius: 3px;
background-color: rgba(0, 0, 0, 0.47);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.34);
text-shadow: 0 2px 5px rgba(0, 0, 0, .5);
font-weight: 400;
line-height: 1.5;
text-align: center;
color: rgba(255, 255, 255, 0.47);
}
demo
Try this: https://jsfiddle.net/uo23L4n4/
use inline-block instead of block for the buttons.
use text-align:center
<button class=" page-number">1</button>
.center {
margin-left: auto;
margin-right: auto;
text-align: center;
}
.page-number {
display: inline-block;
float: none;
width: 28px;
height: auto;
border-radius: 3px;
background-color: rgba(0, 0, 0, 0.47);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.34);
text-shadow: 0 2px 5px rgba(0, 0, 0, .5);
font-weight: 400;
line-height: 1.5;
text-align: center;
color: rgba(255, 255, 255, 0.47);
}
Change your mark up to a list, makes it very easy to do this.
<ul class="center pages clearfix">
<li><buuton class="center page-number">1</buuton></li>
<li><buuton class="center page-number">2</buuton></li>
<li><buuton class="center page-number">3</buuton></li>
</ul>
Use this css
ul{
list-style:none;
}
li{
display:inline-block;
}