JSFiddle - React, Tailwind, and code Playground
by der_robert
HTML
<div class="trailer">
<div class="hitch">
<div class="support-wheel"></div>
</div>
<div class="wheel"></div>
<div class="counter">
<div class="cash-register"></div>
</div>
<div class="fridge"></div>
<div class="exhaust-hood"></div>
</div>
CSS
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
background-color: #e9ecef;
}
.trailer {
width: 300px;
height: 150px;
background-color: #ddd;
border: 3px solid #999;
border-radius: 20px;
position: relative;
box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}
.fridge {
position: absolute;
right: 10px;
bottom: 30px;
width: 40px;
height: 100px;
background-color: #fff;
border: 2px solid #bbb;
border-radius: 3px;
}
.fridge::before {
content: '';
position: absolute;
left: 5px;
top: 5px;
width: 30px;
height: 90px;
background: linear-gradient(to bottom, #89cff0 0%, #b2f7ef 100%);
border-radius: 2px;
}
.cash-register {
position: absolute;
left: 50%;
bottom: 30px;
transform: translateX(-50%);
width: 40px;
height: 20px;
background-color: #444;
border-radius: 3px;
}
.cash-register::before {
content: '';
position: absolute;
top: -10px;
left: 50%;
transform: translateX(-50%);
width: 35px;
height: 10px;
background-color: #888;
border-radius: 2px;
}
.exhaust-hood {
position: absolute;
top: 10px;
left: 50%;
transform: translateX(-50%);
width: 120px;
height: 20px;
background-color: #bbb;
border-radius: 3px;
}
.exhaust-hood::before {
content: '';
position: absolute;
top: 20px;
left: 10px;
width: 100px;
height: 10px;
background-color: #aaa;
border-radius: 2px;
}
.hitch {
position: absolute;
bottom: -5px; /* Adjusted to bottom */
right: -75px; /* Moved to the right edge of the trailer */
width: 80px; /* Increased width for visibility */
height: 10px;
background-color: #333;
border-radius: 5px;
}
.hitch::before {
content: '';
position: absolute;
left: 50%; /* Centered to the hitch */
top: -15px; /* Moved above...