Manipulating graphics with CSS - dynamically linking Divs

I'm attempting to create a unique design by connecting a series of dynamically generated content divs with CSS. The goal is to have a curved line every three divs, complete with an arrow image at the end and an additional line to separate the contents.

Does anyone have any suggestions on how this can be implemented? While I have limited experience with CSS3, I believe it might offer a solution for this task.

I've explored the idea of inserting a fixed-height element between the divs, but that approach seems too rigid and not practical in the long run.

Just to clarify, the "arrow" image itself is not the challenge here - it's figuring out how to represent the "green line" effectively.

If you need a visual reference, here's a mockup of what I'm aiming to achieve:

Answer №1

If you want to achieve this, you can mix the following elements:

pseudo elements

:nth-child

Take a look at this basic code snippet to get started (keep in mind that it's just a starting point and you may need to add more before/after elements as list item children):

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>
</ul>

CSS:

body {
    text-align: center;
}

ul {
    display: inline-block;
    margin: 0 auto;
    list-style-type: none;
}

ul li {
    position: relative;
    float: right;
    border: solid 1px #000;
    margin: 5px;
    width: 50px;
    height: 50px;
}

ul li:after {
    content: '';
    position: absolute;
    top: 50%;
    right: -11px;
    width: 11px;
    height: 5px;
    background: green;
}

li:before {
    content: '';
    position: absolute;
    top: 50%;
    left: -11px;
    width: 11px;
    height: 5px;
    background: green;
}

li:nth-child(3n+1) {
    margin-bottom: 60px;
    clear: right;
}

li:nth-child(3n+1):before {
    content: ''; <!-- potentially your image URL -->
}

Live Demo: http://jsfiddle.net/bartkarp/nd39pwh3/

If you have any questions or need further clarification, feel free to ask! :)

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 is the best way to indicate that the most recent web service call has finished in a Javascript

I am trying to execute the following code block: this.setState({ // <------------ REF 1 pages: pages }); only after all axios.get('https://graph.facebook.com/v5.0/' + page.id + '/events?access_token=' + accessToken) requests have ...

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 ...

JPlayer experiencing technical difficulties on Internet Explorer and Opera browsers

Hey there! I'm facing an issue with my website . I've uploaded some ogg and m4a files for streaming, and while it works perfectly on Firefox, Safari, and Chrome, it's not functioning properly on IE. When I try to play a song, it seems to loa ...

Is there a way to make a text area move along with the mouse cursor?

I have been working on my first website and everything is running smoothly so far. However, I have a new idea that I am struggling to implement. Some of the pages on my site feature a video player with buttons to select different videos. When a viewer hove ...

json request not functioning properly in Internet Explorer and experiencing difficulties with caching

Unfortunately, the code snippet provided below is compatible only with Firefox and not Internet Explorer. The JSON file breaks when it encounters the text "Meanscoil na mBraithre Criostaí": "2028425":[19, "Awaiting Correction", "", "Meanscoil na mBra ...

A guide on clearing the selected value in a dropdown menu with Angular.js

Can someone assist me with setting the drop-down value to blank after completing an action in Angular.js? Below is my code explanation: <div style="height:270px; overflow-x:hidden; overflow-y:scroll;" ng-show="viewOrderTable"> <div class="table-r ...

Error: The function 'toEqual' is not recognized by the 'expect' method causing

I've been following along Dan Abramov's Redux tutorial which can be found at () Lesson 9 covers testing and the usage of expect and .toEqual() This is the code I'm working on: var expect = require('chai').expect; var freeze = re ...

Ways to detect drag event on a CytoscapeJS node (specifically the one directly underneath the cursor/touch)

Currently, I am utilizing Cytoscape JS to develop a web browser-based tool for manipulating graphs. I am encountering an issue related to listening to the drag event of multiple selected nodes. I have successfully listened to the 'drag' event of ...

What is the process for incorporating a unique pop-up window in Shopify?

Hey there! I'm looking to incorporate a pop-up window that will appear when a user clicks on a link or button on the product page. This pop-up will display washing instructions, for example. I came across this code snippet, but it doesn't seem t ...

Utilizing Javascript for logging into Facebook

Feeling frustrated! I've been struggling to implement the Facebook Login pop-up on my website using the Facebook JavaScript API. Despite following tutorials, I can't seem to make the login pop-up appear. Instead, when I go through the login pro ...

Exploring the utilization of CSS host selectors with Angular4 to target direct child elements

Within my app.component.css file, I currently have the following code snippet: * ~ * { margin-top: 24px; } This rule actually adds some top margin to all elements that come after the first one. However, this is not exactly what I intend to achieve. My ...

JavaScript interprets code differently each time it runs

After returning to work this morning, I encountered some strange behavior that disappeared after restarting the server. Despite my efforts, I couldn't recreate it. So, consider this question "solved" and feel free to delete it if necessary. I'm n ...

How can I automatically update the content of a specific Div element when the page is loading using the Ajax load() function

This is the HTML code I have: <body onload="fun1()"> <ul id="nav" class="nav" style="font-size:12px;"> <li><a href="#" id="m_blink" onclick="fun1()">Tab1</a></li> <li><a href="#" id="d_blink" onclick="f ...

Showing JSON Array Values in a Table

I have created an array and am attempting to display its values in a table. Initially, my solution only displayed a single value from the array that matched an exact ID. You can see this implementation at (). Entering "jjones" would yield a result. I then ...

Change the structure of the JavaScript object into a new format

I humbly ask for forgiveness as I am struggling with figuring out how to accomplish this task. It seems like we need to utilize a map function or something similar, but I am having difficulty grasping it. Below is the object 'data' that I am wor ...

Enhancing Security with Subresource Integrity in Angular-Cli

Has anyone discovered a way to enable Subresource Integrity with Angular-CLI? I came across this GitHub Pull Request that suggests it may become a feature in the future: GitHub Pull Request. I tried to activate it on the current versions but had no luck. ...

Guide to successfully passing a function as a prop to a child component and invoking it within Vue

Is it really not recommended to pass a function as a prop to a child component in Vue? If I were to attempt this, how could I achieve it? Here is my current approach: Within my child component - <template> <b-card :style="{'overflow-y&apo ...

Issue: TypeError: Unable to access the 'getBoundingClientRect' property of an undefined value

Is there anyone who can lend me a hand? I encountered an issue: TypeError: Cannot read property 'getBoundingClientRect' of null https://i.stack.imgur.com/Jnfox.png Here is the code snippet I am trying to render: <div className="box&qu ...

What could be the reason behind the app.get middleware not functioning properly following the app.use middleware in ExpressJS?

My server.js file includes the following code. However, I've encountered an issue where the code in app.get() function works fine when the app.use() middleware is commented out. But, when both are included, the get request doesn't seem to run. An ...

Avoid interrupting the code execution until it has finished completely

Let's discuss a common scenario: $('button').on('click',function(){ // Performing AJAX requests (which may take some time); }); If the user clicks the button multiple times, numerous ajax requests can be triggered. To prev ...