Show the layout of the table in a visual format

I am struggling to showcase a table created using <ul> tags. I want the content to be displayed one after the other. Here is my code:

CSS

.activity-list-header > li {
    display: inline-block;
    text-align: left;
    width: 15.666%;
    list-style: outside none none;
}

.activity-list-body > li {
    display: inline-block;
    text-align: left;
    width: 15.666%;
    list-style: outside none none;
}

HTML

<div>
    <ul class="activity-list-header">
        <li>Activity</li>
        <li>Session</li>
        <li>Rate Type</li>
        <li>Rate</li>
        <li>Qty</li>
        <li>Select</li>
    </ul>
    <ul class="activity-list-body activity-list-body-1">
        <li>Activity name</li>
        <li>Session name</li>
        <li>Rate Type name</li>
        <li>Rate name</li>              
        <one-rate activity="activity" selected-date="selectedDate" >            
            <li>Qty name</li>
            <li>Select name</li>
        </one-rate>
    </ul>
    <ul class="activity-list-body activity-list-body-1">
        <li>Activity name</li>
        <li>Session name</li>
        <li>Rate Type name</li>
        <li>Rate name</li>              
        <one-rate activity="activity" selected-date="selectedDate" >            
            <li>Qty name</li>
            <li>Select name</li>
        </one-rate>
    </ul>
 </div>

The issue I am facing is that I want all the content to be in a single row, but this doesn't happen because the last two <li> are wrapped inside <one-rate> being used in AngularJS. I understand that it is not correct to wrap <li> apart from within <ul>. I need a solution to this problem without altering the existing html structure.

View my fiddle here

Answer №1

It appears that the HTML code provided is not in accordance with standard syntax as only li elements are allowed as children of ul, not custom elements.

Despite this, both Firefox and Chrome do not seem to have issues with it, and there is a workaround to fix your styling problem: by adjusting the selector from .activity-list-body > li to .activity-list-body li (expanding the scope to any descendant of this class), your layout should display correctly.
Note: if you have nested lists, additional modifications may be necessary to maintain the layout.
Please bear in mind that this solution has not been tested on Safari or Internet Explorer versions 8 to 11.

For an updated version, refer to this fiddle: https://jsfiddle.net/abc123def/1/

Answer №2

After devising a lengthy solution, I discovered that simply eliminating the > in the css on .activity-list-body > li is all it takes to get it functioning properly.

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

Using Angular 2 to trigger an event when a native DOM element is loaded

I am working towards my main objective of having a textarea element automatically focused upon creation. I recently came up with an idea to use e.target.focus() on the onload event. It would look something like this: <textarea rows="8" col="60" (load)= ...

Set the button to align on the left side within a Bootstrap card

Creating grid elements in Bootstrap 3, I am faced with a challenge. When the viewport is below <768px, I want to align a button in the same position as shown in the image with the lion. Check out the demo site here. For viewports >768px, the button ...

Making an asynchronous request using Ajax to verify the status of a checkbox

I have two checkboxes, and I want to make an ajax call to a jsp page when one of the checkboxes is clicked. The jsp page should display a table with data fetched from a database. The issue arises when dealing with two checkboxes: <div class="search-in ...

Ways to stop a JS plugin affecting HTML anchors and preventing them from automatically scrolling to the top

My friend is working on a website and he's using a plugin called Flip Lightbox. The basic functionality of the plugin is that when you click on an image, it flips over and pops out as a lightbox. Everything works fine, however, if you scroll down the ...

Arranging items in a vertical column using Bootstrap styling

I am facing a particular issue: The initial design is displayed in Picture 1: I am using Bootstrap 5 as my CSS framework. I attempted to utilize the pre-built columns feature, but so far, I have not been able to find a solution and am currently strugglin ...

"Error message stating 'Unresolved variable' occurs in the code while trying to assign className={styles.nameOfClass

My current task involves adjusting the style of a button in ReactJS using the "className" property. However, I encountered an error message in WebStorm stating "Unresolved variable nameOfClass," and the desired style changes did not reflect when running we ...

Pass data from Action Class to ajax using JSON syntax

Currently I am facing an issue while working on fullCalendar, a jQuery plugin. I am trying to populate event details from a database when the Calendar page loads, but I seem to be stuck with a silly problem that I can't figure out. $('#calendar& ...

Understanding the Functioning of a Digital Analog Clock Using JavaScript

As a new learner, I found the operation of a Digital analog clock to be quite puzzling. I was presented with an image called clock.png, and I specifically struggled with how the hands of the clock function. Javascript - const deg = 6; // defining the valu ...

Attempting to determine which PHP form was submitted

I'm currently working on creating multiple forms within the same page, but I've encountered an issue where the PHP code is not executing properly when attempting to submit the form. <form id="DeleteEmployeeModal" name="DeleteEmployeeModal ...

Subdomain Dilemma: Trouble with Images in Internet Explorer

Currently, I am working on creating a basic website on a subdomain. Everything appears to be running smoothly in Google Chrome except for one issue with the header image not displaying in IE8. The image link is . It seems that the problem may stem from IE ...

AngularJS displays the value from the dropdown menu in the input field

I am looking for a way to display the text "login" and "password" from $scope.logins when a user clicks on them in a dropdown menu. $scope.logins = [{ "login" : "log", "password" : "pass" }] Here is the HTML code: <div class="drop ...

Customizing Thickness for Tab Labels in MUI 5

I have been trying to adjust the thickness of the label inside a tab using MUI 5, but so far I haven't had success. Here is what I have attempted: interface TabPanelProps { children?: React.ReactNode; index: number; value: number; } funct ...

Brainstorm: Creative ways to showcase excess content within a div

I'm struggling to find a suitable title for this issue. Essentially, I have a box-shaped div that expands into a rectangle and reveals content when clicked. The problem arises when I animate the div's width during expansion. Instead of positioni ...

Establish starting dimensions and remember the previous sizes of allocations

I successfully implemented a draggable split panel using a code library from johnwalley on GitHub called https://github.com/johnwalley/allotment. My goal is to achieve the following functionalities: Clicking on Expand or collapse the allotment B should e ...

The jQuery button function is not compatible with Google Graph

Upon review below, I have successfully created the getChart() function. It functions properly when called independently, however, it fails to display the chart when enclosed within $(document).ready(function(){...}). The file is also attached for referen ...

Switching the displayed image depending on the JSON data received

As a beginner in javascript and jQuery, I am working on displaying JSON results in the browser. My goal is to generate dynamic HTML by incorporating the JSON data. Below is an example of the JSON structure: [{"JobName":"JobDoSomething","JobStatus":2,"JobS ...

Creating a Jira-inspired table layout in Angular by embedding components in a structured format

I'm attempting to recreate the functionality of Jira where I can create a "gadget" that can be added to a board, resized, moved, and deleted. (For those unfamiliar with why this might be useful, think of gadgets like the "Gantt" gadget. You can add a ...

Uniform selection frame width across nested list elements

I want to ensure that the width of the selection frame for all nested ul li elements is consistent, just like in this example. When hovering over an element (making the entire line clickable), I don't want any space on the left. Currently, I am using ...

Initiate Action Upon Visibility

After discovering this script that creates a counting effect for numbers, I realized it starts animating as soon as the page loads. While I appreciate its functionality, I would prefer it to only initiate when the element is in view; otherwise, the animati ...

Creating a new project in ASP Net Core Angular using Bootstrap 4 for the SideMenu layout instead of Bootstrap 3

I am currently working on developing a website using Angular6, where I aim to have a vertical navbar for large screens and a top navbar with dropdown functionality for mobile devices. While searching online, I came across several examples that seemed overl ...