Layout with no defined boundaries in a grid formation

Is there a way to remove the border from each corner of a grid, similar to the attached image, without using specific classes for each column? The grid generates columns dynamically based on data. Can you provide guidance on how to achieve this?

Fiddle

HTML:
<ul>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
</ul>

CSS:

ul{list-style:none; width:260px;}
ul li{
    display:block;
    width:50px;
    height:50px;
    border:1px solid black;
    float:left;
    margin-left:-1px;
    margin-top:-1px;
}

Answer №2

when utilizing the CSS below in this specific scenario:

     ul{ list-style: none; width: 260px; }
     ul li{
        display: block;
        width: 50px;
        height: 50px;
        border-right: 1px solid black;
        border-bottom: 1px solid black;
        float: left;
     }

     ul li:nth-child(5n){
        border-right: none;;
     }

     ul li:nth-child(n + 21){ border-bottom: none; }

there is no necessity for using the negative margin hack to conceal overlapping borders

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

break-word property not functioning correctly within pre tag

Each row in my dataTable triggers a modal to appear: <div id="verifyModal" class="modal"> <div class="modal-content"> <h2>Verify # <span id="verify-modal-id"></span></h2> <pre><code class="" id="verif ...

Is there a way to pause the slideshow? Are there any ways I can enhance the code to make it more efficient?

Currently, I am testing a slideshow that automatically transitions every 1 second. I have set it up to pause when it reaches the first image. However, when it stops on the initial image and I click the next button, nothing happens. If I try to interact wit ...

Customize Material-UI Icons styles in React app

I'm working on a React.js app with Typescript and I need to remove the default visited Material Icons coloring from an anchor tag. Here's the stylesheet I tried: const useStyles = makeStyles((theme: Theme) => createStyles( myAnchor: ...

Tips for reducing noise on your website during the deployment process

Currently in the process of creating a website and incorporating fonts from Google Webfonts. While these fonts appear sleek and flawless on Google's own site, once implemented onto my own site they seem quite noisy. Any suggestions for how to prevent ...

Stop the body from scrolling when the side panel is opened

Whenever I click on my button with the class "cd-btn," it triggers the toggling of my panel with the class "cd-panel.is-visible." jQuery(document).ready(function($){ //open the lateral panel $('.cd-btn').on('click', function(event){ ...

Creating a border with tabs and a triangle using CSS

I'm having trouble getting my HTML/CSS tabs to look like the ones in the image. I've experimented with border-radius but haven't been able to achieve the desired result. Can anyone provide guidance on how to replicate these tabs using only ...

When resetting a form, the styled radio buttons remain selected and do not deselect

I have a set of three styled radio buttons for car rental pickup locations: <div class="col-md-12 form-group"> <label for="car-rental-pickup-location" class="mb-2">Pickup Location<small class="text-danger">*</small></label>&l ...

Using CSS3 to clear floats without altering the HTML structure

Despite searching for multiple solutions to this issue, I have yet to find one that works without requiring me to modify my HTML code. Here is the current HTML in question: <div class="name">Daiel</div> <div class="amount">30€</div ...

The left and right edges are not extending across the entire screen

Can anyone help me determine if this is a duplicate issue? I'm unsure why my left and right borders are not extending the full width of the screen. The website in question is ojs.monojitbanerjee.co.cc Here is the structure: <body> <div id= ...

How to Verify if a WebControl Contains Server-Side Blocks in ASP.NET

I am looking for a way to identify if a Web control contains server blocks in code, without necessarily parsing the entire file or scanning for specific tags. The reason for this requirement is because I have numerous old Web forms that were created witho ...

Malfunctioning JavaScript timepiece

I am currently experimenting with using Raphael to create a unique clock feature on my website. My goal is to animate the seconds hand to mimic the movement of a traditional clock. Below is the code snippet I have implemented: window.onload = function( ...

Styling Images Inside a DIV Container Using CSS Float

Considering that I have 2 divs with images and text, I encountered some formatting issues when attempting to float the image to the left using float:left;. The strange formatting is ruining the layout. Below, I've included my code snippet along with a ...

Does the physical size of the CSS pixel unit change when the screen pixel density changes?

My current focus is on understanding responsive images, particularly in relation to setting image dimensions. For instance, if I were to set an image with a width of 100px and height of 100px, would it appear smaller on a high-resolution screen? I am cur ...

Unable to display image using HTML and CSS

I want to display two images (download and view) on top of another set of images. Here is the HTML code: <div class="row"> <div class="col-md-3 col-sm-4 col-xs-6 backgrounddownload backgroundview"> <a href="{site_url}scents/baobab/ ...

Tips for concealing a button post-click

Just updated my code, please take a look! I have created a button using HTML, CSS, and JavaScript and I am trying to figure out how to hide it once it's clicked. Below is the HTML for the button that should play music when clicked: <audio id="my ...

The padding of the iFrame does not match the padding of the source

After creating a compact javascript Rich Text Editor, I noticed a discrepancy in the padding of certain elements when I view it within an iframe. This issue is apparent in the image directly from the source: However, when I embed it in an iframe using the ...

Is there a way to have the menu displayed on a single line and consistently centered?

I am working on a menu that needs to stay centered at the top of the screen, with a consistent appearance and just one line, regardless of the screen width. However, I'm encountering an issue where the menu mysteriously transitions into a two-line for ...

Function that is triggered by scrollbar height indicator

I'm currently utilizing jQuery to retrieve the user's current height and triggering an animation function once they reach that height (similar to reactive websites where animations occur as the user scrolls down the page). However, I am struggli ...

Place a written message on an picture

<head> <style> .relative{position:relative; width:600px;} .absolute-text{position:absolute; bottom:1; font-size:12px; font-family:"vedana"; background:rgba(251,251,251,0.5); padding:10px 20px; width:10%; text-align:center;} </style> < ...

Tips for creating a multi-line text field with ellipsis using a div in CSS

Similar Question: How to Insert Ellipsis in HTML Tag for Content that is Too Wide Using CSS to Display “…” on Overflowing Multiline Blocks Hello, I am attempting to create a div tag to present a question. The size of this div bo ...