How to make the new long shadow trend with CSS?
Check out this tutorial on how to do that with Sass: http://css-tricks.com/metafizzy-effect-with-sass/
and take a look at this CodePen with the full result: http://codepen.io/hugo/pen/nwivF
Your example above is pretty much the only way to do it with pure CSS, and while it does look pretty crazy - it will let you adjust those text-shadows using transitions and such.
Creating a flat long shadow for boxes in CSS with less CSS
You can use 2 pseudos with skew to simulate the same shadow
div {
min-height: 64px;
width: 64px;
text-align: center;
background-color: cyan;
border: 1px solid blue;
position: relative;
}
div:before, div:after {
content: "";
position: absolute;
top: -1px; /* compensate border in the root element */
left: -1px;
right: -1px;
bottom: -1px;
z-index: -1;
transform-origin: right bottom;
}
div:before {
transform: skewX(45deg);
box-shadow: 1px 60px 0px 0px gray, 1px 120px 0px 0px lightgray; /* 1px in x direction to avoid small gap between shadows */
}
div:after {
transform: skewY(45deg);
box-shadow: 60px 0px gray, 120px 0px lightgray;
}
<div>
wow that's a lot of CSS!
</div>
Ray-like shadow
You can get this effect by making several box/text shadows farther and farther away. Realistically, this would be very hard to code yourself, so you should probably use mixins or javascript. See this example: http://codepen.io/awesomephant/pen/mAxHz
i need the exact shadow with css not with image for input field
If you can wrap your input with a label, you could do something like this, where you combine pseudo elements with a rotation.
.shadow {
position: relative;
}
.shadow::before,
.shadow::after {
content: '';
position: absolute;
z-index: -1;
width: 40%;
height: 100%;
top: -5px;
background: transparent;
box-shadow: 0px 10px 5px #bbb;
}
.shadow::before {
left: 10%;
transform: rotate(-5deg);
}
.shadow::after {
right: 10%;
transform: rotate(5deg);
}
<label class="shadow"><input type="text"></label>
How can I make a shadow with a material design card?
Make a custom card
///custom cards
Widget card(String image) {
return Container(
child: Image.asset(
image,
fit: BoxFit.cover,
),
decoration: BoxDecoration(
border: Border.all(color: Colors.blue, width: 2.0),
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(5.0),
),
boxShadow: <BoxShadow>[
new BoxShadow(
color: Colors.blue,
blurRadius: 3.0,
offset: new Offset(0.0, 3.0),
),
],
),
margin: EdgeInsets.all(5.0),
height: 150.0,
width: 100.0,
);
}
Box Shadow is what you need. I hope this will help.
Adding shadow to textbox onFocus
Haven't tested it but this should work:
$(function(){
$("input").on("focus",function(){
$(this).addClass(".inputShadow");
});
});
Edit: also check browser compatibility, as mentioned in other answer
Drawing shadow with Quartz is slow on iPhone & iPad. Another way?
You should set the shadowPath
property. It is how CoreGraphics is able to optimize shadows.
For example, if your view is an opaque rectangle:
self.contentView.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.contentView.bounds].CGPath;
Related Topics
Has the ::-Webkit-Selection Selector Ever Been Supported
Label Next to Selectinput in Shiny
How to Set CSS Hover Effect, on Parent and Child Elements
Disable Bootstrap for One Element
CSS Selector When :Target Empty
Draw a Static Line Between Two Divs
How to Create a Concave Bottom Border in CSS
How Add Class to Parent in Angular Application
Wrapping a Text Around a Circular Element
How to Identify and Eliminate Unused CSS Styles from My Bloated Stylesheet
Display:Block Not Working in Chrome or Safari
Background-Position Not Working with CSS Animation and Linear Gradient
Are CSS Variable Changes Possible Upon a Radio Button's Checked Selector Being Triggered
Nesting CSS @Supports and @Media Queries