I'm using Twitter's Bootstrap library to quickly throw together a prototype.
Here's what my layout looks like in HTML:
<div class="navbar-messages container">
<div class="alert alert-info fade in">
<button class="close" data-dismiss="alert">×</button>
<strong>Awesomeness!</strong> You're pretty cool.
</div>
<div class="alert alert-error fade in">
<button class="close" data-dismiss="alert">×</button>
<strong>Awesomeness!</strong> You're pretty cool.
</div>
</div>
Here's what my LESS looks like:
div.navbar div.navbar-messages {
.drop-shadow(1px 1px 10px 1px rgba(0, 0, 0, 0.2));
div.alert {
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
margin-bottom: 0px;
&:last-child {
-webkit-border-bottom-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-moz-border-radius-bottomright: 4px;
-moz-border-radius-bottomleft: 4px;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
}
}
}
.drop-shadow(@params) {
-moz-box-shadow: @params;
-webkit-box-shadow: @params;
box-shadow: @params;
}
What's really weird is that the drop shadow isn't curving around the child element's curved corners:
How can I make it properly curve around the corners?
Your div.navbar div.navbar-messages
element lacks rounded corners, so the shadow appears square. As described by its name, box-shadow
draws a shadow around the element's box, and not the element's contents, so if the box itself doesn't have rounded corners, then neither will its shadow.
You can try applying the same border-radius
styles to div.navbar div.navbar-messages
as well, so its shadow will curve around the corners:
div.navbar div.navbar-messages {
.drop-shadow(1px 1px 10px 1px rgba(0, 0, 0, 0.2));
.rounded-bottom-corners(4px);
div.alert {
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
margin-bottom: 0px;
&:last-child {
.rounded-bottom-corners(4px);
}
}
}
.drop-shadow(@params) {
-moz-box-shadow: @params;
-webkit-box-shadow: @params;
box-shadow: @params;
}
.rounded-bottom-corners(@params) {
-webkit-border-bottom-right-radius: @params;
-webkit-border-bottom-left-radius: @params;
-moz-border-radius-bottomright: @params;
-moz-border-radius-bottomleft: @params;
border-bottom-right-radius: @params;
border-bottom-left-radius: @params;
}
I have this:
blockquote {
border: none;
font-style: italic;
font-size: 20px;
line-height: 40px;
font-weight: 300;
padding: 0;
margin: 30px 0;
text-shadow: 0 1px 1px #666666;
background: rgba(255,255, 255, 0.4);
box-shadow: 0px 0.5px 1px #888888;
padding-left: 10px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
}
So:
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
That worked for me pretty well! Thanks a lot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With