Posted in
9645
1:24 am, July 20, 2021
CSS Drawing - Beach Scene
i did this one a while ago, cantr even remember it just appeared when i searched in google.
here is an animated version, check the bottom for the css version of this:
HTML
<div class='wrap-box'>
<div class='main-box'>
<div class='sky'></div>
<div class='sea'>
<span class='line'></span>
<span class='line'></span>
<span class='line'></span>
<span class='line'></span>
<span class='line'></span>
<span class='line'></span>
<span class='line'></span>
<span class='line'></span>
<span class='line'></span>
<span class='line'></span>
<span class='line'></span>
<span class='line'></span>
</div>
<div class='beach'>
<div class='sand-dots'>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
<span class='dot'></span>
</div>
</div>
<div class='cloud cloud-one'>
<div class='cloud-inner'>
<div class='cloud-right'></div>
<div class='cloud-middle'></div>
<div class='cloud-left'></div>
</div>
</div>
<div class='cloud cloud-two'>
<div class='cloud-inner'>
<div class='cloud-right'></div>
<div class='cloud-middle'></div>
<div class='cloud-left'></div>
</div>
</div>
<div class='cloud cloud-three'>
<div class='cloud-inner'>
<div class='cloud-right'></div>
<div class='cloud-middle'></div>
<div class='cloud-left'></div>
</div>
</div>
<div class='cloud cloud-four'>
<div class='cloud-inner'>
<div class='cloud-right'></div>
<div class='cloud-middle'></div>
<div class='cloud-left'></div>
</div>
</div>
<div class='sun'></div>
<div class='tree'>
<div class='tree-bits'>
<div class='leaf leaf-one'></div>
<div class='leaf leaf-two'></div>
<div class='leaf leaf-three'></div>
<div class='leaf leaf-four'></div>
<div class='trunk trunk-one'></div>
</div>
</div>
</div>
</div>
CSS
.wrap-box {
width: 400px;
margin:0 auto;
/*
top: 50%;
left: 50%;
position:absolute;
margin-left:-200px;
margin-top:-200px;
*/
}
.main-box:hover {
transform: rotate(-3deg);
transition: 0.3s;
box-shadow:0px 0px 20px rgba(0,0,0,0.2);
}
.main-box {
border-radius:3px;
height: 400px;
background: #EFEFEF;
border:10px solid #FFF;
box-shadow:0px 0px 10px rgba(0,0,0,0.1);
position:relative;
overflow:hidden;
transition: 0.3s;
}
.sky {
width:100%;
height:150px;
background:linear-gradient(#038ec9,#bdf0f1);
}
.sea {
width:100%;
height:130px;
background:linear-gradient(#016dad,#90dfe3);
}
.beach {
width:100%;
height:100px;
background:linear-gradient(#fdf6cb,#dda863);
}
.cloud {
position:absolute;
top:20px;
right:10px;
opacity:0.8;
width:80px;
filter: drop-shadow(0 1px 10px rgba(0,0,0,0.1));
animation:clouds 60s infinite;
}
.cloud-one {
top:50px;
right:30px;
zoom:1.2;
animation:cloud-one 60s infinite;
}
.cloud-two {
top:90px;
left:30px;
opacity:0.7;
animation:cloud-two 20s infinite;
}
.cloud-three {
top:70px;
left:50px;
opacity:0.7;
}
.cloud-four {
top:70px;
right:100px;
opacity:0.9;
zoom:0.7;
}
.cloud-inner {
position:relative;
}
.cloud-inner div {
background:#FFF;
}
.cloud-middle {
width:80px;
height:30px;
background:rgba(255,255,255,0.3);
border-radius:30px;
}
.cloud-right {
position:absolute;
right:10px;
top:-20px;
height:30px;
width:30px;
border-radius:50px;
background:rgba(255,255,255,0.3);
}
.cloud-left {
position:absolute;
left:10px;
top:-20px;
height:35px;
width:35px;
border-radius:50px;
}
.sand-dots .dot {
background:rgba(0,0,0,0.1);
height:3px;
width:3px;
border-radius:10px;
display:inline-block;
margin:9px 5px 8px 10px;
float:left;
}
.dot:nth-child(1) { margin-top:30px; }
.dot:nth-child(2) { margin-top:68px; }
.dot:nth-child(3) { margin-top:28px; }
.dot:nth-child(4) { margin-top:21px; }
.dot:nth-child(5) { margin-top:92px; }
.dot:nth-child(6) { margin-top:47px; }
.dot:nth-child(7) { margin-top:22px; }
.dot:nth-child(8) { margin-top:58px; }
.dot:nth-child(9) { margin-top:13px; }
.dot:nth-child(10) { margin-top:73px; }
.dot:nth-child(11) { margin-top:95px; }
.dot:nth-child(12) { margin-top:24px; }
.dot:nth-child(13) { margin-top:40px; }
.dot:nth-child(14) { margin-top:53px; }
.dot:nth-child(15) { margin-top:73px; }
.dot:nth-child(16) { margin-top:4px; }
.dot:nth-child(17) { margin-top:82px; }
.dot:nth-child(18) { margin-top:93px; }
.dot:nth-child(19) { margin-top:4px; }
.dot:nth-child(20) { margin-top:10px; }
.dot:nth-child(21) { margin-top:92px; }
.sea .line {
display:block;
height:2px;
width:10px;
background:rgba(255,255,255,0.1);
position:absolute;
}
.sea {
position:relative;
}
.line:nth-child(1) { top:10px; left:331px; }
.line:nth-child(2) { top:20px; left:257px; }
.line:nth-child(3) { top:30px; left:126px; }
.line:nth-child(4) { top:40px; left:346px; }
.line:nth-child(5) { top:50px; left:275px; }
.line:nth-child(6) { top:60px; left:35px; }
.line:nth-child(7) { top:70px; left:190px; }
.line:nth-child(8) { top:80px; left:235px; }
.line:nth-child(9) { top:90px; left:66px; }
.line:nth-child(10) { top:100px; left:351px; }
.line:nth-child(11) { top:110px; left:240px; }
.line:nth-child(12) { top:120px; left:322px; }
@keyframes cloud-one {
0% {
left:-100px;
}
100% {
left:450px;
}
}
@keyframes cloud-two {
0% {
left:450px;
}
100% {
left:-100px;
}
}
.line {
animation: waves 5s infinite;
}
@keyframes waves {
0% {
margin-left:0px;
margin-bottom:0px;
transform: rotate(0deg);
}
25% {
margin-left:10px;
margin-bottom:0px;
transform: rotate(-10deg);
}
50% {
margin-left:15px;
margin-bottom:5px;
transform: rotate(0deg);
}
75% {
margin-left:10px;
margin-bottom:5px;
transform: rotate(10deg);
}
100% {
margin-left:0px;
margin-bottom:0px;
transform: rotate(0deg);
}
}
.sun {
width:50px;
height:50px;
position:absolute;
top:10px;
right:10px;
background:rgba(255, 214, 0, 0.84);
border:3px solid rgba(255, 214, 0, 0.3);
border-radius:100px;
filter: drop-shadow(0 1px 10px rgba(255, 214, 0, 0.7));
}
.tree {
position: absolute;
bottom: -10px;
right: 25px;
width: 100px;
height: 200px;
}
.tree-bits {
position:relative;
}
.trunk {
background:#865415;
width:30px;
height:200px;
border-radius:30px;
transform: rotate(-20deg);
position:absolute;
right:0px;
}
.leaf {
position:absolute;
width: 100px; height: 100px;
background-color: #A0DE21;
-moz-border-radius: 100px 0px;
-webkit-border-radius: 100px 0px;
border-radius: 100px 0px;
filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}
.leaf-one {
right: 41px;
top: 8px;
z-index: 1;
}
.leaf-two {
right: -62px;
top: -39px;
z-index: 1;
transform: rotate(42deg);
}
.leaf-three {
right: 64px;
top: -25px;
z-index: 1;
transform: rotate(42deg);
}
.leaf-four {
display:none;
right: 64px;
top: -20px;
z-index: 1;
transform: rotate(42deg);
}
Javascript
/*
tags: css animation, css clouds
Inspiration: Hey Duggie. ;)
to generate the random pixel locations i just used the google random number generator
Note: yes the clouds are a bit weird.
- to add.
-: sun
- : palm tree
: leaves
: bucket
: spade
: shells
: bird
CSS Leaf from here: https://jsfiddle.net/xwvyo1c5/
*/
External Link for CSS Drawing - Beach Scene
View Statistics
This Week
366
This Month
1489
This Year
3006
Add Comment
Other Items in css
flex to align pagination in list format
make an image or element grayscale switch on mouse over
rotate an element when its hover
rotate an element when its selected
Left Fixed nav with right fluid content
css html vertical center
css cursor types testing
CSS Object Fit for Image fill rather than using background image on a div
flip card animation 3d front and back css html
six box grid css html custom no gap
four box grid css html custom
Kinda Crappy 3D button code
4 box custom grid css layout stack on mobile 1024 lower
use an image in your list items ol ul li
css grid container with 4 auto columns
select something with custom data attribute css
rainbow text background clip with linear gradient
content-visibility and contain-intrinsic-size for page load rendering speed increase
set a css grid to auto to make it stack on mobile
truncate text with line clamp allow a certain number of lines
using the :user-valid CSS pseudo-class
add a button to an existing link using :after css
bouncing loader animation in css
center a box in the middle of the screen
highlight a button with an animation css
add an outline to everything!
hide the first h3 tag on the page with css
center align vertical 2 items in a container flex
simple javascript no library accordion
button zoom effect with expanding background
scroll left animation
using css counter-increment to add numbering to elements
hidden scroll anchor for custom scroll position
ken burns slow image zoom
using a radial gradient for background overlay
change selected color on input elements css
animated duck on footer
using filter grayscale to make an image dark
bootstrap dark mode
twitter icon font awesome
how to bundle css files together using windows or mac
button with separated chevron
vertically align text within a fixed height div using flex
how to view a web page in its printer format
white space break word css
roboto and poppins fonts include quick code
CSS Drawing - Beach Scene
404 Error Page Codepen
right align something in its element
hide the third row in a table with css
Related Search Terms
Other Categories in Code
alpine js apps c css factorio font awesome images linux quick modals sqlite site bugs site updates slick slider sliders testing windows apps apache api apps asp bat bootstrap bootstrap templates charts cookies core css css filters css grid design elements docker domains emoji fancybox fonts foundation framework gimp git html icons ideas image formatting images javascript javascript functions jquery js linux mac misc modals mysql nginx node php php errors php function php functions php simple html dom pi400 python react regex sections simple_html_dom simplepie php site bugs site documentation slick slider sql sqlite ssh sublime svg svg css templates tools virtual box vscode vue webdev windows windows 11 windows commands wordpress