The positioning of the dropdown menu is not properly aligned to the right

I am currently facing an issue with aligning a dropdown menu button to the right on small screens. The float:right; property seems ineffective in this case.

http://jsfiddle.net/VZ9y8/

Below is the CSS code:

#cssmenu ul,
#cssmenu li,
#cssmenu span,
#cssmenu a {
  margin: 0;
  padding: 0;
  position: relative;

}
#cssmenu {
  height: 49px;
  border-radius: 5px 5px 0 0;
  -moz-border-radius: 5px 5px 0 0;
  -webkit-border-radius: 5px 5px 0 0;
  background: #fefefe;
  background: -moz-linear-gradient(top, #fefefe 0%, #eee9f0 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fefefe), color-stop(100%, #eee9f0));
  background: -webkit-linear-gradient(top, #fefefe 0%, #eee9f0 100%);
  background: -o-linear-gradient(top, #fefefe 0%, #eee9f0 100%);
  background: -ms-linear-gradient(top, #fefefe 0%, #eee9f0 100%);
  background: linear-gradient(top, #fefefe 0%, #eee9f0 100%);
  border-bottom: 2px solid #ffffff;
  width: auto;
  display:block;
}
#cssmenu:after,
#cssmenu ul:after {
  content: '';
  display: block;
  clear: both;
}

... (CSS code continues)

<p>To achieve proper alignment, adding <code>right:-50px seems to work but it's not an ideal or safe solution.

Answer №1

To achieve the desired result, you can simply include these two CSS properties:

.#cssmenu > ul {
    width:100%;
}

By setting the width of your ul to 100% of the screen, the float:right will function as intended.

#cssmenu .has-sub {
   float:right;
}

You can view the updated code here.

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

The ajax call made a double request, with the first one returning a status of 400 and the second one

Here is my code for creating a record: def create @categorization = Categorization.new(categorization_params) @categorization.save respond_to do |format| format.json { render json: {categorization: @categorization.to_json}, success: 20 ...

The art of toggling div visibility with jQuery

When a button is clicked, I want to display a div named 'info'. <button>Toggle</button> <div id="toggle"> Test </div> I'm looking to implement a jQuery sliding feature to reveal the div, but I'm unsure of where ...

The images on the carousel are not properly sized

Having an issue with Bootstrap 4 carousel where the images appear too big and zoomed in. Unsure of what's causing the problem. Here is the HTML code: <div class="carousel-inner"> <div class="carousel-item active col-xs-12 ...

Go through all of the HTML elements

I am trying to select each circle inside a div in order to resize it using jQuery. Below is my code snippet: <div id="DG_circles"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="75"> <desc>Created with Raphaël ...

There has been an unexpected transformation in the website design when using Chrome on large widescreen monitors

Last week, I updated the design of my website and tested it across various browsers and devices. It's a portfolio site built with Bootstrap, and everything looked good. However, this morning when I viewed my website on my widescreen monitor using Chro ...

The JQuery category filtering feature malfunctions when a category consists of more than two words

Utilizing Jquery, I have implemented a feature that displays project categories and allows users to filter projects based on the selected category. To view the code pen for this implementation, please click here: https://codepen.io/saintasia/pen/dzqZov H ...

What exactly does the .proxy() method do in jQuery?

Can you explain the purpose of the jQuery.proxy function in jQuery and describe the scenarios where it is most beneficial? I came across this link, but I'm struggling to grasp its concept fully. ...

Submitting a form within AJAX-powered tabs (using the Twitter Bootstrap framework)

I have encountered an issue while trying to submit a form that is located within tabs. The content of these tabs is generated through AJAX. My problem arises when I submit the form - the page refreshes and loads the "default" tab, causing the PHP function ...

Obtain the HTML code for the dynamic table row (TR)

Looking for guidance on extracting the HTML content of the last dynamically generated row from an HTML table. The structure of the table is as follows: row 1 headings row 2 headings All dynamic rows containing values with text boxes and select boxes L ...

Demonstrating information using a HighCharts pie graph in a Visual Studio web application

Here is a snippet of code that supplies data for the chart within the View: series: [{ type: 'pie', name: 'Chart Title', data: @Html.Raw(Json.Encode(Model)) }] This piece of code can be foun ...

What is causing fullcalendar to fail in rendering events when there is globalization in web.config?

Encountering an issue with Mozilla, but everything works fine in IE The problem arises in my _calendar.cshtml partial view during document.ready $.ajax({ type: "POST", contentType: "application/json", data: "{}", url: "/Ho ...

The dropdown-menu-end class in Bootstrap 5 navbar is not activating on hover as expected

My Bootstrap navbar has right-aligned dropdowns, but when I try changing the trigger to hover, the .dropdown-menu-end class doesn't work as expected. I attempted using CSS for the hover effect: .dropdown:hover .dropdown-menu { display: block; mar ...

Sisense - Mastering UI Customization techniques

As someone new to Sisense, I have been given the challenging task of adjusting the appearance of the Sisense app. The default look resembles what you see in this screenshot: https://i.sstatic.net/7izSY.png To begin, my main focus is on customizing the he ...

Received TypeError: Unable to call reset function - issue clearing input field post ajax request

Having Trouble Clearing Input Fields After AJAX Request: $.ajax({ type: "POST", url: "river_flow.php", data: { username: $("#username").val(), idv:$("#idv").val(), comment: $("#comment").val()}, cache: false, success: function(da ...

The Power of Bootstrap and Jquery Unleashed through Ajax Button

Apologies for the confusion in my previous explanation, let me clarify my question. I have a table row with a button, and when the user clicks on it, an ajax call is made to a web service. Upon successful completion of the call, I want to change the text d ...

What could be causing SimpLESS to throw a syntax error when encountering a forward-slash symbol in the background shorthand?

Can anyone explain why this specific line (line:2) is causing a syntax error on the SimpLESS compiler? When compiling in-browser using CDNs, there are no issues. However, the same code doesn't seem to work correctly on an iPad for some unknown reasons ...

Issue with rendering in sandbox environment versus localhost

Here's a dilemma I'm facing - I have some HTML code on my localhost that looks like this: <div> <p>Go to: <a href="www.foobar.com">here</a></p> </div> On localhost, the output is "Go to: here" with 'he ...

Place a button in relation to the top of its parent element

I am trying to display control buttons at the top of a table cell when hovering over an image within the cell. Here is the HTML structure I have: <table id="pridat_fotky"> <tbody> <tr> <td class=" ...

jQuery.post() function encounters issues with data not being properly posted

I am currently tackling a project that involves sending JSON data to a specific URL. I've been attempting to utilize the jQuery.post() method for this task, but I've run into a couple of roadblocks. The initial issue I'm facing is: jQuery. ...

Showcasing form validation errors using django and ajax

I have set up a contact form using Django and AJAX for users to reach out to me. The current setup works smoothly if no errors occur, but I want to enhance it further by displaying any errors above the input fields along with the inputs themselves. While i ...