How can the column-count property in CSS be adjusted to change the quantity of items displayed in each column?

Check out this http://jsfiddle.net/woyy389L/3 link for a visual representation of the question. It features 4 columns with a total of 5+5+5+2=17 items in the ul.

Is it possible to achieve 5+4+4+4 items using only CSS without altering the HTML structure?

This should be properly displayed on both Firefox and Chrome browsers.

The CSS code provided is:

ul{
   -webkit-column-count: 4;
    -moz-column-count: 4;    
    border:1px solid red;
}

Here is the HTML code:

<ul>
        <li><a class="myclass" href="#"><span>bbb</span></a></li>
        (remaining list items...)
</ul>

Thank you for considering this issue.

Answer №1

Unfortunately, it is not possible to achieve this using only HTML and CSS at the moment.

You can check out Chris Coyier's CSS Tricks for a comprehensive guide on the current capabilities: http://css-tricks.com/guide-responsive-friendly-css-columns/

If you really want to accomplish what you're looking for, you may need to modify your HTML structure or utilize jQuery to dynamically add opening and closing ul tags and style them accordingly.

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

What could be causing issues with mysqli connection to the database?

Here is the content of my connect.php file: $mysql_hostname = "localhost"; $mysql_username = "root"; $mysql_password = "xxxxxxxx"; $mysql_database = "marrybrown_clean"; $bd = mysqli_connect ($mysql_hostname, $mysql_username, $mysql_password) or die (&apos ...

Unable to remove the most recently added Object at the beginning

I am currently working on a project to create a dynamic to-do list. Each task is represented as an object that generates the necessary HTML code and adds itself to a div container. The variable listItemCode holds all the required HTML code for each list it ...

Activate Bootstrap button functionality with JavaScript

Hey team, I've got a Bootstrap button on my HTML page: ..... <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> ... <div class="accept-btn"> <button type="button" class="bt ...

Modify the click function from <tr> to <td> tag

I want to create an HTML page that functions as a digital library for books. Users should be able to click on a rate button to save the selected book to local storage, allowing them to see their rating whenever they revisit the page. However, I'm enc ...

Seeking assistance in optimizing my Javascript code for more efficient canvas rendering

I've created a script for generating random moving lines as a background element for my portfolio. While it runs smoothly on its own, I encounter frame drops when combining it with other CSS animations and effects, especially at the beginning (althoug ...

Page design ruined as a result of oversized fonts in IE9 for <h2> elements

Everything looks great on various browsers, except for the notorious IE9. We've implemented a block-style layout with a width of 660px, centered on the page. Despite setting the h2 width to 660px to match the layout, IE9 displays the font size much ...

The background image's fadeInOut transitions create a strange phenomenon where all the text appears in white

So, here's a strange issue I'm facing. On my website, the background image changes with a smooth fadeIn/Out transition. Video: Website in action: Here is the HTML markup: <div class="fondo" onclick="descargar(2,500);descargar(1,500);"> ...

Click on the submenu to expand it, then simply select the desired option to navigate

I have created a toggle menu that displays a list of child elements when clicked, and hides them if clicked again. However, when a child element is clicked, I want it to navigate to the corresponding page. I am having trouble getting this functionality to ...

Using CSS to position elements absolutely while also adjusting the width of the div

In one section of my website, I have a specific div structure. This structure consists of two divs stacked on top of each other. The first div is divided into two parts: one part with a width of 63% and another part with a button. Beneath the first div, t ...

What could be causing the labels to stay stagnant while the image moves?

What could be causing the labels to remain static while the images (front and back of human anatomy) move on Galaxy S8 and iPhones? Check out the website at . Your assistance is greatly appreciated. ...

Retrieving the most recent HTML bookmark that was clicked

Is there a way to retrieve the most recently clicked html bookmark using javascript/jquery? Here is the html code: <a href="#div1">div1</a> <a href="#div2">div2</a> and the content of DIV1: <div id="div1"> DIV 1 - Lore ...

Aligning the title vertically in Ionic on Android device

Currently, I am in the process of developing an application using the Ionic framework and cordova. After uploading my app for testing purposes, I encountered a small issue. The title in the top bar on Android appears to be misaligned vertically. Is there a ...

Incorporating header and footer elements into the design

I am facing an issue while editing a layout. Currently, when clicking on some side of the layout, a header and footer appear in a certain way. However, I would like to change this so that the header and footer appear differently, similar to the example s ...

Empty screen appears when "npm run serve" command is executed following the build process

I am currently utilizing Material-ui. Following the project build with npm run build, I encounter a blank page when running npm run serve. I attempted to set homepage: "./" in the package.json as suggested here, however, it still displays a blank ...

Tips for aligning carousel indicators in Bootstrap 4

My objective is to reposition the indicators below the slider image by setting the .carousel-indicators with a bottom: -50px; property. However, when I implement this, the indicators simply disappear. I suspect that this issue is related to the overflow:hi ...

Adding a data attribute to a Material-UI Button: A step-by-step guide

I'm trying to include a custom data attribute in the Material-UI Button Component as shown here. Here's what I attempted: <Button inputProps={{ 'data-testid'='clickButton' }} > Click </Button However, this approach ...

Mirror the content of my div code onto a two-dimensional plane using an A-frame

Query I am currently developing a 3D scene using A-Frame () and I am in need of a solution to mirror an HTML div onto a plane within the A-Frame environment. For instance, imagine a scenario where there is a div at the bottom left corner of the screen fun ...

Removing background color when clicking and dragging using CSS

I'm facing an issue with a resizable div that is cropping part of my webpage. Whenever the mouse moves and clicks on the titles and images, a background color appears, as seen in the picture below. Can someone please help me resolve this problem? htt ...

Adaptable background visuals

Struggling to find a solution for a seemingly simple problem. I am looking to create responsive/fluid images that scale relative to the viewport size. I also need to load them using CSS with the background property for selective loading of different versio ...

Trouble with Bootstrap 5 Dropdown Menu failing to drop down

I am attempting to utilize a dropdown menu on my Wordpress site with Bootstrap, but it is not working as expected. If I manually add the class "show" to my dropdown-menu div, the menu displays, but the button does not function. These are the scripts being ...