Arrange list items in an unordered list (ul) side by side

I need to display two child unordered lists side by side. They both have the class names L and R.

Here is the relevant section of the HTML markup.

<ul class="SearchResult">
<li class="Pagination">
<a id="lnkPageNumber_top_1" class="ACTIVE" onclick="ShowPage(this.id);" style="cursor: pointer;">1</a>
<a id="lnkPageNumber_top_2" onclick="ShowPage(this.id);" style="cursor: pointer;">2</a>
</li>
<li>
<ul class="L">
<li style="border: medium none ;">
</li>
<li class="Pagination">
<a id="lnkImagePageNumber_1" class="ACTIVE" onclick="ShowImage(this.id);" style="cursor: pointer;">1</a>
<a id="lnkImagePageNumber_2" onclick="ShowImage(this.id);" style="cursor: pointer;">2</a>
<a id="lnkImagePageNumber_3" onclick="ShowImage(this.id);" style="cursor: pointer;">3</a>
<a id="lnkImagePageNumber_4" onclick="ShowImage(this.id);" style="cursor: pointer;">4</a>
</li>
</ul>
<ul class="R">
<li class="T">Rose Villa</li>
<li>
<span>
<strong>Price</strong>
: Rs. 2,000,000
</span>
</li>
<li>
<strong>Features</strong>
:
<img height="16" width="16" src="bed.png" alt="Beds:" title="Bedrooms"/>
3
<img height="16" width="16" src="bath.png" alt="Baths:" title="Bathrooms"/>
3
</li>
</ul>
</li>
</ul>

The stylesheet being applied is as follows:

ul.SearchResult { width:100%; list-style:none; }
ul.SearchResult li { margin:2px; height:200px; border:solid 1px #B5D335;clear:left; }
ul.SearchResult img { padding:0px; margin:0px; width:235px; height:156px; border:none }
ul.SearchResult li.Pagination { padding:5px; height:auto; }
ul.SearchResult li.Pagination a { color:#669900; font-weight:bold; }
ul.SearchResult li.Pagination a:hover { color:#FF9900; }
ul.SearchResult li.Pagination a.ACTIVE { color:#FF9900; border:solid 1px #B5D335; padding-left:3px; padding-right:3px; }
ul.SearchResult li ul {float:left; list-style:none; }
ul.SearchResult li ul.L { width:245px;} /* Set as Television set BG */
ul.SearchResult li ul.R { width:292px;}
ul.SearchResult li ul li { padding:3px; border:none; height:auto; border-bottom:dotted 1px #C9C9C9; }
ul.SearchResult li ul li.T { text-transform:uppercase; color:#44962A; font-weight:bold }
ul.SearchResult li ul li span { display:table-cell; min-width:125px; width:auto; }
ul.SearchResult li ul li a { color:#44962A; }
ul.SearchResult li ul li a:hover { color:#FF9900; }

However, the side-by-side alignment is not working properly. What could be the issue?

P.S: I came across floating divs in list items which discusses using DIV elements instead of UL like here. Is "clear:left" applicable for both?

This might be a commonly asked question among CSS experts, but for someone like me who is new to it, your patience is appreciated [:)]

Edit Note:- To provide more clarity, here's an image you can refer to: alt text http://www.yetanothercoder.com/img.jpg

Answer №1

To resolve the positioning issue with your UL's, you can add clear:none to them like this:

ul.SearchResult li ul {float:left; clear:none; list-style:none;}

By using float, you are able to position the element, but in order for other elements to be positioned next to it rather than below it, clear:none needs to be applied :)

I hope this explanation helps!

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

Tips for evaluating style modifications on mouseover using cypress

Trying to test hover styles on table rows but encountering issues: Here is the code snippet I am testing: it("Table rows should display correct hover styles", () => { cy.get("table>tbody>tr").each(($el, index, $list) =&g ...

Accessing server-side function from the client side

Seemingly, this issue is quite straightforward. Within an ASPX page, there exists a button as follows: <input id="ok" type="button" name="ok" value="OK"> Upon clicking this button, the goal is to invoke a method in the code behind and execute a pos ...

Unable to display hamburger icon when utilizing React.js

The hamburger icon is not appearing on mobile, even though it seems to be working. However, when I click on the icon, it does not show up on mobile devices. Here is my HTML code: .hamburger { cursor: pointer; height: 16px; margin: 10px 0 -1px 1 ...

Firefox causing images to have a white border after rendering

My image (.png) has a white border only in Firefox, despite the CSS border property being set to 0. Is there a solution to remove this unwanted border around the image? ...

Trigger Screen Reader to Announce When a Component Is Deleted

When the last filter item is removed, I want the screen reader to announce "All Filters Are Removed." However, if the active filter component is removed without any other element to assign an aria-label attribute, I'm not sure how to handle this situa ...

Comparing SignInManager's IsSignedIn method with User.Identity's IsAuthenticated property

The default _LoginPartial.cshtml provided by the Asp.net Core web application template looks like this: @inject SignInManager<ApplicationUser> SignInManager @inject UserManager<ApplicationUser> UserManager @if (SignInManager.IsSignedIn(User)) ...

Is it feasible to have my progress bars load only upon clicking the link for my div?

I have a link to my div called mySkills, and currently the progress bars load automatically when I access my page. However, I only want the progress bars to load when I click on the link (href) to this specific div mySkills. How can I achieve that functi ...

Error message: Attempted to access a GridView selected row value in the Session when the index was out

I am attempting to store the values of a selected row in a GridView into sessions using a button field within the GridView. However, I keep encountering an Index out of range error at this line: GridViewRow row = AdminSearchGridView.Rows[index] Please no ...

The Gridview mysteriously vanishes upon postback if paging functionality is activated

I am encountering an issue with a gridview where the DataSourceID property is set to a custom ObjectDataSource object. Whenever I set AllowPaging to True, the GridView disappears after a postback. However, when I set AllowPaging to False, everything works ...

When linking to a section, the Bootstrap navbar obscures the top part of

I have been working on my inaugural website for educational purposes and encountered the following issue: Every time I try to link to a specific section on the same page, it opens as intended but the top portion is obscured by the navbar. <body data-s ...

When you print, transfer HTML tags to a separate page

I need help with writing a report that pulls data from a dynamic database. I added code to force a page break after every second div tag, but since the content is constantly changing, some div tags end up spanning across pages when printed. Is there a way ...

What could be causing my jQuery handler to not capture my form submission?

I am developing a Ruby web application and using JQuery and AJAX to send/receive data. However, I am facing an issue where pressing the enter key does not submit the form. What should I do to ensure that my form submits successfully? Within my Foundation ...

Video on YouTube restarts upon hiding and revealing its container div

Is there a way to retain the progress and playback position of a YouTube video embedded within a div on a webpage? Currently, when I hide and then show the div using jQuery/CSS, the video reloads and starts from the beginning. Is there a solution to avoid ...

Utilizing both italic and span tags within a list element in xslt with distinct separation

Just diving into the world of XSLT and seeking some guidance. I have a task at hand where I need to generate an XML file to be sent to Adobe InDesign server. The input HTML files contain "li" elements with nested "span" tags and "i" (italic) tags which I w ...

PHP login system that retrieves information from a selected database

Currently, I am in the process of creating a login system using PHP, but I have encountered an error: Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/a9356103/public_html/login.php on line 13 The code sni ...

Creating a dynamic form with jQuery and assigning unique names to two different inputs

Currently, I am working on a program that necessitates adding a text box and textarea dynamically to a form. To achieve this, I am utilizing the clone function. Unfortunately, I have hit a roadblock in assigning unique IDs to each box. Below is the Jquery ...

"Transitioning from Bootstrap version 3.3.7 to the latest Bootstrap version 4.1.3

Everywhere I look, it says that Bootstrap 4.1 is compatible with Bootstrap 3, but when I update my project to the newer version, a lot of things stop working, such as this cookie consent feature. @{ Layout = ""; } @using Microsoft.AspNetCore.Http ...

What method can I use to locate the double quote option within an HTML select element using jQuery?

Here is an example of the select: <select id="id0" name="name0"> <option value='30" size'> 30" size </option> </select> The select contains double quotes. I am trying ...

Are you looking to add some flair to your Flexbox layout using Media

I am in the process of developing a website using flexbox, and one key aspect of the design is to hide the navigation bar, specifically the left panel in this JSFiddle, when the viewport width is between 480px and 1023px. The current implementation achieve ...

The jQuery fadeToggle function toggles the visibility of an element starting from hidden instead

I'm having an issue where text in my div only appears on the second click, instead of the first. What could be causing this problem? $('#fPaperCirclePic').on('click', function () { $('#fPaperCircleText, #isargebla, #moq10 ...