create a list item that expands to occupy the rest of the available space

I'm having trouble filling the remaining space with the last element in my list. I've tried several solutions, but they all apply to div elements with fixed or variable positions. However, this is a list element that represents a simple menu:

<html>
<head>
<title>Cie Inc</title>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
<style type='text/css' media='all'>
body { 
  font-family: verdana, helvetica, arial, sans-serif;
  font-size: 100%;
  font-style: normal;
  font-variant: normal;
  font-weight: normal;
  background-color  : #fff;
  color : #222; 
  min-width:1020px;
}
.extra  {
  position: relative;
  height: 100%;
  margin: 0 auto -132px ;
  overflow:hidden;  
  display: block;
  min-height : 100%;
}
.main   {
  width: 980px;
  height: 80%;
  margin: 0 auto;
  padding: 0px;
  font-size: 0.875em;
  line-height  : 1.785em;
  overflow:hidden;  
  display: block;
}
header  {
  position: relative;
  width: 99%;
  overflow:hidden;  
  display: block;
}
.indent {
  position: relative;
  padding: 10px 0 0px;
  overflow:hidden;  
  display: block;
}
nav{
  border : solid red;
}
.menu   {
  position: relative;
  border : solid blue;
  width: auto;
  margin: 0px;
  padding: 0px;
  background-color  : #fff;
  overflow:hidden;  
  display: block;
}
.menu li    {
  width : auto;
  position: relative;
  float: left;
  background-image  : url('images/menu-spacer.gif');
  background-position  : right top;
  background-repeat  : repeat-y;
  overflow:hidden;  
  display: block;
  padding-right:2px;
}
.menu li:first-child a  {
  width: 58px;
  padding: 6px 0px 8px;
  background-image  : url('images/menu-home-icon.png');
  background-position  : center center;
  background-repeat  : no-repeat;
  background-color  : #CFCFCF;
  overflow:hidden;  
  display: block;
  text-indent:-9999px;
  border-radius:9px 0px 0px 9px;
  -moz-border-radius:  9px 0px 0px 9px;
  -webkit-border-radius: 9px 0px 0px 9px;
}
.menu li:last-child {   
  line-height  : 58px;
  overflow:hidden;  
  background-image  : url('none');
  background-color  : #cfcfcf;
  border-radius: 0px 9px 9px 0px;
  -moz-border-radius: 0px 9px 9px 0px;
  -webkit-border-radius: 0px 9px 9px 0px;
}
.menu li a  {
  padding: 6px 30px 8px 30px;
  color: #000;
  font-size: 22px;
  font-weight: 400;
  text-decoration : none;
  text-transform : capitalize;
  line-height  : 2em;
  background-color  : #CFCFCF;
  overflow:hidden;  
  display: block;
  letter-spacing: -1px;
}
.menu li a.active   {
  background-color  : #B6B6B6;
  overflow:hidden;  
  display: block;
}
.menu li a:hover    {
  background-color  : #666;
  overflow:hidden;  
  display: block;
  cursor:pointer;
}
</style>
</head>
<body id='accueil' >
  <div class="extra"> 
   <div class="main"> 
     <header>
       <div class="indent">
         <nav>
           <ul class='menu'>
             <li><a class='active' href='index.php?Choix=1_' >Home</a></li>
             <li><a href='index.php?Choix=2_' >Who Are We</a></li>
             <li><a href='index.php?Choix=3_' >Our Services</a></li>
             <li><a href='index.php?Choix=4_' >Our Team</a></li>
             <li><a href='index.php?Choix=7_' >Reach Us</a></li>
             <li>&nbsp;</li>
           </ul>
          </nav>
        </div>
      </header>
    </div>
  </div>
</body>
</html>

Answer №1

To utilize the remaining space, apply float:none; to .menu li:last-child.

Check out this JSFiddle example

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

What methods can I use to prevent a number from becoming negative?

I am currently developing a game where players collect resources, spend them to create more resources, and engage in various activities. However, I'm facing an issue where the resource count goes into negative numbers when too much of a certain item i ...

Problem with using Twitter Bootstrap in IE11 when Browser Profile Enterprise is enabled

I am facing an issue with a Bootstrap 3 web page. Some machines have IE configured to load intranet pages in Enterprise profile mode, while others have the default Desktop profile set in IE11. This configuration has caused the layout to break completely. ...

Generate unique identifiers in HTML

Below is my HTML and JavaScript code: <!DOCTYPE html> <html> <head> <style> .custom-div { border: 1px solid green; padding: 10px; margin: 20px; } </style> <script> ...

Preventing access to websites on mobile devices: A step-by-step guide

Ensure an error page is shown when the website is accessed on a mobile device. I've attempted the following: @media only screen (max-device-width : 768px) { html,body { display: none; } } as well as: if( /Android|webOS|iPhone|iPad|iPod|BlackB ...

What is the solution for addressing the size problem of the image within the modal?

img1 img2 Upon clicking on the modal, it displays the image similar to a lightbox, but the issue arises when the image becomes scrollable and does not fit the screen properly. Take a look at the code below: HTML <div class='row'> ...

The container is unable to contain the overflowing Slick carousel

The carousel in Slick is overflowing the container. Expected Result - First Image / Current State, Second Image Parent Container HTML (layout) <main> <div class="layout__main-container p-4"> <app-discover-animals clas ...

Create an HTML document with a text element that has a bottom

I need to emphasize specific text that requires underlining. <div><span class="text">Underlined</span><br>blah blah</div> As a result, the content should be displayed as follows: Underlined --- blah blah In my SASS/SCS ...

Conceal Primeng context menu based on a certain condition

I'm struggling to prevent the context menu from showing under certain conditions. Despite following the guidelines in this post, the context menu continues to appear. My goal is to implement a context menu on p-table where it should only show if there ...

Exploring the world of Bootstrap Twitter 3.0 alongside the wonders of Knockout

When utilizing Twitter Bootstrap, the validation classes like has-error or has-warning must be added to the wrapping form-group element to style both the input and its label. However, Knockout-Validation directly adds the class to the input element itself. ...

Create a right-to-left (RTL) CSS file within a create-react-app project and dynamically switch between them depending on changes

I am currently working on a multi-language project using create-react-app. My goal is to incorporate a library like "cssJanus" or "rtlcss" to transform the Sass generated CSS file into a separate file. This way, I can utilize the newly created file when sw ...

Guide to sending parameters using the POST method from page 1 to the iframe of page 2 via the GET method

The objective is to send a value to the iframe in candidatelogin2.asp from candidatelogin.asp. Within candidatelogin.asp: <form method="POST" action="http://127.0.0.1/hello/candidatelogin2.asp"> It is possible to retrieve the value from a hidden ...

Unable to modify the main button color using LESS in the ant.design framework

I am experiencing an issue with using ant design to style a primary button. I have tried to change the background color using LESS, specifically by setting @btn-primary-bg: #1B2F55, but for some reason, it does not work. I know I could easily change the ba ...

What is the best way to eliminate excess padding resulting from font size adjustments?

Facing a coding challenge and seeking assistance. Two input fields are displayed side by side. The second field (in green) is slightly higher, indicating a possible padding or margin setting at the bottom. Issue does not occur when font size of second in ...

"An issue with the external jQuery file loop causes it to skip either the first or

I have a webpage where I am dynamically loading content from an external JavaScript file. This file identifies div elements with a specific class name and then fills the content of those divs based on a custom attribute, which contains a link to an API. Th ...

Aligning CSS items to flex-start prevents them from being centered

My flex container has justify-content: flex-start, but I want to center the items inside it. EDIT: For reference, I'd like it to resemble the video recommendations on the YouTube homepage. Here is my code that doesn't seem to be working as expe ...

How to use Nokogiri to efficiently extract targeted nodes from HTML

In my Ruby script, I am trying to extract specific values from an HTML document using the Nokogiri gem. The HTML content I'm parsing includes information about a user and their registered device. #!/usr/bin/ruby require 'Nokogiri' doc = No ...

Conceal a div until reaching the end of the webpage by scrolling

Currently, I am working on a web page inspired by music release pages (check out an example here). My goal is to have certain hidden divs at the bottom of the page only reveal themselves once the user has scrolled all the way down, with a delay of a few se ...

Retrieve the Element from the Shadow DOM or leverage the main site's styles

I am currently involved in a project that utilizes Polymer (still on version 1.7, but we are planning to switch to a different technology instead of upgrading). My task involves exploring ways to integrate DynamicYield, a personalization platform that inse ...

A fixed HTML div with a relative div is like having your own

I am in search of two divs with the following styles: <div style="height:20px;" /> <div style="height:100%;" /> These divs result in one being 20px tall and the other spanning 100% of the screen height, causing a vertical scrollbar that is eq ...

Go back to the top by clicking on the image

Can you help me with a quick query? Is it feasible to automatically scroll back to the top after clicking on an image that serves as a reference to jQuery content? For instance, if I select an image in the "Portfolio" section of , I would like to be tak ...