Arranging div elements in a vertical stack with CSS

Looking for help in arranging div elements in a way that they resemble an equalizer, similar to the one shown in this screenshot Equalizer. Can you provide advice on how to remove the dots from the list? I've already attempted using the CSS property (list-style-type: none) but it didn't work.

Additionally, how can I create a gradient color effect for this equalizer, transitioning from lighter to darker shades from top to bottom?

Thank you in advance.

* {
  padding: 0;
  margin: 0;
}

body {
  background: #333333;
}

li:first-child {
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
}

ul li {
  background: linear-gradient(orange, yellow);
  margin: 5px;
}

.blocks {
  position: relative;
  top: 40px;
  left: 15px;
  display: inline-block;
  width: 40px;
  height: 20px;
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8>;
  <title>Equalizer</title>
  <link rel="stylesheet" href="equalizer.css">
</head>

<body>
  <div class="blocks">
    <ul>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
    </ul>
    <!--<div></div>
<div></div>
<div></div>
<div></div>
<div></div>-->
  </div>
  <div class="blocks">
    <ul>
      <li></li>
      <li></li>
    </ul>
    <!--<div></div>
<div></div>-->
  </div>
  <div className="blocks">
    <ul>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
    </ul>
    <!--<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>-->
  </div>
  <div className="blocks">
    <ul>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
    </ul>
    <!--<div></div>
<div></div>
<div></div>
<div></div>
<div></div>-->
  </div>
  <div className="blocks">
    <ul>
      <li></li>
      <li></li>
      <li></li>
    </ul>
    <!--<div></div>
<div></div>
<div></div>;-->
  </div>
</body>


</html>

Answer №1

If you want to achieve a similar layout using CSS Grid, check out this example: https://codepen.io/matt5409/pen/zWxVqK

The key to this design lies in the way the grid is set up:

.col{
  display:grid;
  grid-template-columns:repeat(3, 1fr); // create 3 columns
  grid-column-gap: 2px; // set 2px gap between columns
  align-items: end; // make sure items align at the bottom
}

Answer №2

To achieve this specific layout, I would recommend utilizing a single element and controlling the size using height:

body {
  background: #333333
}

.equ {
  display: inline-block;
  width: 40px;
  height: 180px;
  border-radius: 5px 5px 0 0;
  background: 
  linear-gradient(transparent 80%, #333333 20%)0 0/100% 40px, 
  linear-gradient(orange, yellow);
}
<div class="equ">
</div>
<div class="equ" style="height:60px">
</div>
<div class="equ" style="height:220px">
</div>
<div class="equ" style="height:140px">
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Challenges with implementing @Html.EditorForModel

Currently, I am developing a web application using asp.net's mvc-5 framework. In this project, I have implemented the following model class: public class Details4 { [HiddenInput(DisplayValue=false)] public string RESOURCENAME { se ...

Position the div beneath another div using the display:grid property

I can't seem to figure out how to position a div below another div using display:grid. The div is appearing on top instead of below. The "app-bm-payment-card-item" is actually a custom Angular component. Here's the HTML file: //div wrapper < ...

What is the JavaScript method for updating an HTML5 datalist to show new options?

When populating options dynamically into an HTML5 datalist, I'm facing an issue where the browser tries to display the datalist before all the options have loaded. As a result, the list either does not show up completely or only partially shows up. Is ...

Adjusting the width of input textboxes for alignment

I currently have a set of input textboxes that I have attempted to align using CSS with the {width: xxx px;} property. However, this method is unreliable as it does not consistently ensure proper alignment. <style> #left_col p { margin-top: 15px ...

Unusual marking on the navigation bar

Currently, I am making updates to a website that was created by a previous employee long before I joined the team. One of the requested changes is to eliminate the orange box surrounding the navigation links. The navigation appears to be generated using Ja ...

What is the best way to display a div based on a keyword match?

If the keyword search results in a match, I can display the corresponding input text and its related category div. Now, I am attempting to also search through category names. If the searched keyword matches a category name, that specific div should be visi ...

Viewing a Google Charts graph upon the loading of a web page

Utilizing the Google Charts library, I have incorporated a graphic on my web page that is dynamically added using AJAX into a <div> element. To display the graph when the page loads, I have written the following code: <script type="text/ ...

"Troubleshooting the issue of consistently receiving null values when uploading files with

I'm facing an issue with uploading a file using jQuery AJAX. Although I can see all the details of the file object such as its name and size, when I check the console with formdata.get("files"), the context.request.files size always shows zero. It see ...

Troubleshooting: Unable to Display Collapsing Navbar in Bootstrap 5 When Toggler is Pressed

My attempt at creating a collapsing navbar isn't working as expected, and I'm struggling to identify the issue. I have set up a collapse toggler that should target #navbar1. However, when I shrink the page, the Navbar collapses, the .navbar-togg ...

Toggle the visibility of div elements by clicking on another div

Hey everyone, I have this cool concept where clicking on different flags will reveal a corresponding list. However, my jQuery code doesn't seem to be functioning properly. $('.canadaflag').click( function() { $(".canadalocations").toggl ...

Is there a lack of a feature for automatically shifting to the next input element in dynamically-created HTML?

I have a JavaScript function that is triggered when a user clicks a button: htmlstring = ''+ '<div class="input_holder">'+ '<div class="as_input_holder"><input tabindex="1" class="as_input form-control-sm ...

Bootstrap navbar problem: struggling to adjust padding for image and navigation links

Can anyone help me understand why my navbar isn't displaying padding on the left and right as specified in my CSS? I've been trying to figure it out for a while now, but I'm not sure if I need to remove the div-container fluid or if I'm ...

Issue with external JavaScript file being unresponsive on mobile browser

Hello everyone, hope you're having a great afternoon or evening I've encountered an issue with mobile browsers like Chrome Mobile and Kiwi where the external js file is not visible in the html file. The script.js file looks like this: alert(&ap ...

Having two owl carousels on one page is causing some issues

Struggling to implement two owl carousels on my page. Gif: View Gif Here The first carousel (shown at the top in the gif) is functioning perfectly. However, the second one (beneath the first in the gif) is not behaving as expected. Instead of displaying ...

Struggling to locate a straightforward sidebar solution without relying on Bootstrap. Finding an easy-to-use answer seems

I have a lightweight and easy-to-understand code for a website project with two panels. The first panel on the left is a large navigation (270px width, top to bottom, similar to a wiki) with approximately 30 unordered list items. Next to it is the second ...

My code gets disrupted when I switch between ids and classes

I'm currently learning about javascript and jquery, attempting to implement various scripts. I successfully executed the following script: jQuery(document).ready(function($) { var scroll_start = 0; var startchange = $('#homepage-header' ...

Comparing currency to double in handlebars: a comprehensive guide

I've been working with Handlebars.js and encountered an issue when trying to compare product prices above $35. The problem arises from the fact that prices are stored as "$54.99" which gets treated as 0 when compared to a number. How can I effectively ...

Unicef's animated web content

Looking to learn more about gate animation and zoom page transition on the Unicef website? I want to incorporate these cool animations into my own project. Can someone provide me with a "keyword" or point me in the right direction to find information on ...

Tips for deleting extraneous cells in a table without altering the placement of the other cells and refraining from employing CSS

I'm struggling with understanding how to merge cells in a table. Can someone explain the rules for merging table cells to me? I want to remove certain cells from the table without using CSS, I just want to make it look clean. <table border="1" ...

The Art of HTML and CSS Layouts

My code is displaying a layout where the 'Login or Signup' link is not aligning to the right side of the page as intended. Can anyone help me with this issue? HTML <header> <h1>Heading</h1> <p>A clean, minimal, gri ...