For practice and fun, I am seeking to recreate the following logo in pure CSS in one element
If you notice, each "bar" has a small, shadowed grey area, which gives it a sense of depth. I'd like to create these in pure CSS, if possible. The tricky thing to me is that it looks like they go behind bars on top of them, so it'd have to be on an individual bar level in order to do that as opposed to applying a mask to the whole thing.
Thus far, I have been able to create the bars using a pseudo-element and some box shadows and have given the B the colors using a gradient and background-clip: text
.
Normally I'd use a rotated element or mask to apply the shadows, but since I created the bars using box-shadows, I do not know how I would, or even if I can, apply them to an individual shadow (technically speaking they're all one shadow, but I mean apply it to one bar without covering others)
My code
<div class='B'>B</div>
body {
background:#FFF8E6;
}
.B {
position:absolute;
top:50%;
left:50%;
margin-top:-150px;
line-height:236px;
font-size:225pt;
font-weight:bold;
font-family:'Carrois Gothic SC', sans-serif;
background-image:-webkit-gradient(linear, left top, left bottom, color-stop(9%, #FFBF7F), color-stop(9%, #F4A668), color-stop(19.6%, #F4A668), color-stop(19.9%, #F38669), color-stop(28.7%, #F38669), color-stop(29%, #AF9F88), color-stop(49%, #AF9F88), color-stop(49%, #cfb698), color-stop(70%, #cfb698), color-stop(70%, #ecd2b1));
color:transparent;
-webkit-background-clip: text;
}
.B:after {
content:'';
z-index:-1;
position:absolute;
left:-387px;
height:45px;
width:150px;
border-radius: 0px 0px 0px 50px;
box-shadow: 180px -12px 0 -9pt #FFBF7F, 220px -12px 0 -9pt #FFBF7F, 276px -12px 0 -9pt #FFBF7F, 215px 11px 0 -8pt #F4A668, 220px 11px 0 -8pt #F4A668, 275px 11px 0 -8pt #F4A668, 255px 33px 0 -8pt #F38669, 275px 33px 0 -8pt #F38669, 255px 56px 0 -9pt #898481, 276px 56px 0 -9pt #898481,
/* I DON'T KNOW HOW TO FLIP THESE WITHOUT ADDING AN ELEMENT */
275px 78px 0 -8pt #A4978E, 300px 101px 0 -8pt #B8A28A,
/************************************************************/
250px 90px 0 0px #CABBA8, 190px 45px 0 0px #CCBCAC, 150px 0 0 0px #FCCDA1;
}
Now, I don't think this is possible, but I'm always surprised by the ingenuity that SO users have.
TL,DR How can I create these diagonal shadows without adding more elements? I'd be open to alternate ways than the method I'm using if needed
EDIT: Here is the final result
I would suggest you to separate every line into separate DIV and use the following code to create the desired SHADOW EFFECT :
This will be really helpful in achieving the desired result. You can modify it according to your needs and requirements.
Hope this will help you!
Well, I couldn't leave that question open ...
I haven't been able to solve it using your approach. Making the inclined shadows was doable, making it clipped under the circular borders, not (at least I haven't find the way).
Alternative: using a huge amount of backgrounds:
Most of the backgrounds are used to reproduce the part of the design that you already had. To get the shape, you need a rectangular background with a circular one at the left.
For the shadows, there are 2 techniques used.
The easy one is when you have all the shadow contained in a rectangular region. Then you can get it using the same linear gradient that is making the rectangular region,just giving it a darker shade.
The more difficult are those that overlap the circle part. Here I needed to use another separate background image for the shadow.
result
I have only validated the result in Chrome.
Of course this technique can be used in the letter:
updated CSS for the letter
commented backgrounds CSS
Not perfect, but you can get some shadow in the circles with another step in the radial gradient:
The limit is that the shadow in that case must be concentric to the border. The alternative would be to set another background, may be an elliptical one.
shadows on circles