including extra information beside a <ul> unordered list

I have a list of product specifications that I need to display in a spec sheet format. Here is the code I have so far:

<div class="productspec">

<ul>
<li>Product Description</li>
<li>Device Type</li>
<li>Bundled Services</li>
<li>Form Factor</li>    
<li>Processor</li>
<li>RAM</li>
<li>Hard Drive</li>
<li>Data Link Protocol</li>    
<li>Power</li>
<li>Dimensions (WxDxH)</li>
<li>Manufacturer Warranty</li>
<li>Bundled with</li>    
</ul>

</div>

Currently, each feature is listed on the left side but I would like to display the corresponding descriptions on the right side of each feature.

I am having trouble figuring out the best way to achieve this layout.

Is there a way to place the feature descriptions within the same list to achieve this layout?

Fiddle

Answer №1

To achieve the desired layout, it is recommended to utilize nested span elements within the li element. The span elements should have the CSS property display: inline-block; and a designated fixed width.

View Demo

.productspec {
    border-style: solid;
    border-width: 1px;
    border-color: #CCC;
}

.productspec li:nth-child(even) {
    background-color: rgb(245,245,245);
}

.productspec li {
    text-indent: 10px;
    line-height: 30px;
    list-style: none;
}

ul li span {
    display: inline-block;
}

ul li span:nth-of-type(1) {
    width: 250px;
}

Additionally, it is worth mentioning that utilizing a table for tabular data is acceptable. In the case of tabular data, using table, tr, and td elements can simplify the task significantly.

Answer №2

Remember to adjust padding in your style sheet to suit your needs

 <style type="text/css>
     span{ padding-left:30px;}
    </style>

    <ul>
    <li><span> Item Name </span> <span>Item Description</span></li>
    </ul>

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

Fixing the mobile display issue with react-responsive-carousel

I am relatively new to ReactJS and I am looking to develop a responsive Carousel. Here is the code snippet that I have currently: To achieve a responsive Carousel for both desktop and mobile devices, I utilized the react-responsive-carousel library. The ...

Read a local file using the HTML5 FileReader

I am currently working on developing an offline application that can read text from a locally stored text file. I have been researching and found that using html5 and FileReader can make this possible. My goal is to set a hard-coded relative path for the ...

Utilizing jquery for displaying and hiding notifications - Notyfy in action

Recently, I've started working with jQuery and have come across the useful Notyfy jQuery plugin. My goal is to display a notification bar with specific messages based on certain conditions such as success or error. I'm trying to achieve somethin ...

The copyright (©) symbol is unresponsive to rotation

Why can't I rotate the © character? Am I missing something? .copy { font-size: 12px; font-family: Arial; writing-mode: vertical-rl; text-orientation: mixed; transform: rotate(180deg); } <span class="copy">&copy; This is not ...

Determine the length of the content within an HTML container that has

I am attempting to retrieve the length of the container's content in HTML dynamically. However, I am only receiving the object instead of the desired result. <script> $(document).ready(function (e) { var adsense_box_len = $(&apo ...

Creating customized placeholders using CSS padding in HTML5

I came across this helpful post and attempted various methods to adjust the padding for my placeholder text, but unfortunately, it seems unwilling to cooperate. Below is the CSS code. (EDIT: This CSS was generated from SASS) #search { margin-top: 1px; ...

What is the best way to show and hide text by toggling a link instead of a button?

I need help with toggling between two different texts when a link is clicked. I know how to achieve this with a button in JQuery, but I'm not sure how to do it with a link. <h1>Queries and Responses</h1> <p>Query: What is the larges ...

Stay tuned for updates on elements being loaded into a div from an external source

I have a project in progress that involves integrating HTML and JQuery. One of the tasks is to replace a div with a new one from an external HTML file using the load('some.html #someDiv') method. Everything was going smoothly until I tried to li ...

Tips for eliminating flicker upon the initial loading of a webpage caused by dynamic changes in CSS styles through JavaScript

Struggling with the load order of my CSS and JavaScript... Currently, I have a div with a blue background that is styled to appear sliced diagonally. However, upon initial page load (or CTRL+SHIFT+R), there's a brief moment where the slice effect doe ...

List application now includes the capability of adding three items in one go, rather than just one

Furthermore, when the script is placed in the same file as the html, it results in the addition of two items simultaneously instead of three. var itemNum = 1; $("document").ready(function() { $("#addCL").click(function() { var itemId ...

When using flexgrid, be aware that adjacent divs on the same row may shift position when applying floats

Struggling with aligning the divs in a row when floating one of them? Here's a snippet to illustrate the issue: .flex-grid { display: flex; justify-content:space-between; } .flex-grid .rcorners1 { border-radius: 25px; background: green; ...

Using the "export default" feature in React.js is a

Is it possible to name an exported function as "default" without encountering an error? export default() => { const [width, setWidth] = useState(0); const [height, setHeight] = useState(0); useEffect(() => { setTimeout(() => { setWidth(window.i ...

Adjusting Position for Parallax Effect using Jquery

I am currently experimenting with a basic Scrolldeck Jquery Parallax effect to scroll items at varying speeds. However, I am encountering some difficulties in making items move from top to bottom. In the example provided below, you will see a shoe moving f ...

Different ways to restrict Table Header to 2 lines using CSS

When it comes to limiting text to a specific width, using white-space:nowrap is usually the go-to solution. However, I am facing a unique challenge where I need to make sure my header text fits within a specific width. I initially tried adding individual ...

How to enhance the design with a box-shadow for a :after pseudo element

One of the challenges I'm facing involves a CSS design with a div called .testimonial-inner that has an arrow created using the :after pseudo element. The issue is making them appear as one cohesive element, especially when applying a box-shadow. Her ...

Turning off font ligatures in CSS (letter connections deactivation)

Typically, modern web browsers will automatically merge certain letter combinations, such as 'f' and 'i', into a single character known as a ligature. While this can enhance readability, it may not always align with a designer's pr ...

Bootstrap mobile menu logo design

Currently, I am working on a bootstrap template where I have created a div class containing a logo. However, I have noticed that when I resize the Chrome window, the logo overlaps with the mobile menu. Here is the mobile version of my site: https://i.sst ...

What is the most efficient way to transform HTML into React components effortlessly?

I have been attempting to automate the process of converting HTML into React components. I followed the link below to automatically convert HTML into React components: https://www.npmjs.com/package/html-to-react-components However, I encountered an issue ...

As I spun four images along the outer edge of a circular border, one image came to a halt at 90 degrees, revealing its content. Now, I am looking to enlarge that particular

I managed to rotate four images around a circular border and stop one image at every 45-degree angle. However, I am struggling to enlarge the image that stops at 90 degrees on the website while still showing the content of the respective image when it reac ...

I am facing difficulty in incorporating an IP address or URL within an IFRAME in my Cordova Android application

This page does not allow any iframes to load except for the YouTube video URL. When attempting to use any other iframe URL, the following error code is displayed: Error : net::ERR_BLOCKED_BY_RESPONSE In the example below, any URL or IP address fails to l ...