rrrrrr
by velo_ninja
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dynamic Divs</title>
<style>
</style>
<script>
//--------------
let counterRows = 0;
let counterNote = 0;
//-------------------------------------
function createDiv(id, title, color) {
const div = document.createElement('div');
div.id = id;
div.classList.add('cell');
div.textContent = title;
div.style.backgroundColor = color;
div.style.borderColor = color;
div.style.borderRadius = '2px';
div.style.display = 'flex';
div.style.alignItems = 'center';
div.style.justifyContent = 'center';
return div;
}
function createRepeatedBlocks(data1, data2) {counterRows++; //<-- counting up ITEMS;
for (const key in data1) {
const rowData = data1[key];
for (let i = 0; i < rowData.ids.length; i++) {
const divId = rowData.ids[i] + '_' + i;
let title = rowData.titles[i];
//-----> Main-SECTION <-------------------------------------------------------------------------
const div = createDiv(divId, title, rowData.colors[i]);
if (rowData.ids[i] === 'divMain') {
divMain = div;
divMain.style.display = 'block';
document.body.appendChild(divMain);
//-----> TASK-SECTION <-------------------------------------------------------------------------
} else if (rowData.ids[i] === 'divTask') {
divTask = div;
createRow(data2.row1, divTask); // Create rows within divTask
divMain.appendChild(divTask); // Append divTask to divMain
divTask.style.minHeight = '40px'; // Set height of divTask
divTask.id = 'divTask';
}
//-----> NOTE-SECTION...
CSS
.row {
border-bottom: 3px solid red !important;
}
.row {
border-bottom: 3px solid black !important;
}
#divTask {
bottom: -5px; /* Adjust this value to control the distance of the underline from the text */
left: 0;
width: 100%;
height: 8px; /* Adjust the thickness of the underline */
background: linear-gradient(to right, rgba(0, 100, 255, 0.5), rgba(100, 250, 55, 0.4)); /* Gradient color */
border-radius: 5px; /* Rounded corners */
box-shadow: 0 3px 5px rgba(0, 0, 0, 0.8); /* Shadow effect */
}