`Issues encountered with resizing the menu``

Looking to create a unique restaurant horizontal list bar for my application. The goal is to have a horizontal menu that displays 3 options on the screen at a time, with the middle one being the largest and the two flanking it smaller in size. As I scroll horizontally through the options, I need the size of each option to adjust accordingly. I've managed to write most of the code but could use some help figuring out how to dynamically change the sizes based on what's currently visible. Any assistance would be greatly appreciated.

Here is my HTML code:

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charest="utf-8" />

    <title>main screen</title>

    <link rel="stylesheet" type="text/css" href="question.css" />

</head>

<body>
    <div class="wrapper">

        <h1> choose your restaurant </h1>
        <div class="lists">
            <ul>
                <li>
                    <a href="#">pastori</a>
                </li>
                <li>
                    <a href="#">moses</a>
                </li>
                <li>
                    <a href="#">pizza</a>
                </li>
            </ul>
        </div>
    </div>
</body>
</html>

And here is my CSS code:

* { 
    padding: 0; 
    margin: 0; 
} 
h1 { 
    text-align: center; 
    font-size: 30px; 
    margin: 30px 0px;
} 
ul { 
    list-style-type: none; 
    margin: 0px auto; 
    overflow-x: auto; 
    width: 340px; 
} 
li { 
    float: left; 
    width: 100px; 
    height: 30px; 
    margin: 0px 4px; 
    border: 2px solid #111; 
    border-radius: 3px;
} 
li a { 
    display: inline-block; 
    color: black; 
    margin: 0px 4px; 
    width: 100px; 
    height: 30px; 
    line-height: 30px; 
    text-decoration: none; 
    text-align: center; 
}      
.wrapper { 
    text-align: center; 
}

Answer №2

It seems like your query is a bit unclear to me. Could you please provide a screenshot of what you are looking for?

h1{ text-align: center; font-size: 30px; margin: 30px 0px;} ul { list-style-type: none; margin: 0px auto; overflow-x: auto; width: 340px; } li { float: left; width: 100px; height: 30px; margin: 0px 4px; border: 2px solid #111; border-radius: 3px;} li a { display: inline-block; color: black; margin: 0px 4px; width: 100px; height: 30px; line-height: 30px; text-decoration: none; text-align: center; } .wrapper{ text-align: center; }

li:hover{  
   height: 60px; 
   background-color:red;  
}
<title>main screen</title>

<link rel="stylesheet" type="text/css" href="question.css" />
    <h1> choose your restaurant </h1>
    <div class="lists">
        <ul>
            <li>
                <a href="#">pastori</a>
            </li>
            <li>
                <a href="#">moses</a>
            </li>
            <li>
                <a href="#">pizza</a>
            </li>
        </ul>
    </div>
</div>

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 React in ES5 to create a button that triggers two separate functions with a

I have encountered an issue with two React classes that both contain a render function returning forms with buttons. In class A, I had to import class B in order to use the form from class B. The problem: Whenever I click the inner button, the outer butto ...

Managing the invocation of a promise multiple times in AngularJS, and handling some specific exceptions

After previously asking a question on handling promises multiple times in AngularJS (AngularJS handle calling promise multiple times), I am facing a new challenge. This time, I need to retrieve a list of cities, but encounter an exception. Similar to how ...

Using JQuery and PHP to make an Ajax request and handle JSON response

I'm attempting to complete a straightforward exercise: The task involves entering two numbers in separate inputs, clicking a button, and seeing the result appear in a third input. sum.html: <html> <head> <title>Sum</tit ...

The Forge Viewer's getState() function is providing inaccurate values for individual items

In our Angular application, we have integrated the latest version of Forge Viewer and are storing the current state of the viewer in our database for future restoration. After thorough testing, we discovered that isolated nodes are not being saved correct ...

Issue: Retrieve comments via AJAX (from database) in Laravel 5.2

Currently, I am developing a comments section for posts where users can leave comments without the need to refresh the page. However, I am facing an issue in displaying these comments instantly on the post without any page refresh. This is how I have stru ...

Modal's ng-click not triggering component's function

I am currently working on resolving an issue. My choice to use AngularJS is intentional, as I prefer not to load the entire NPM of Angular. Additionally, we heavily rely on Razor Syntax for the Web Layer. Implementation in Create.cshtml file <button ...

What is the method for stopping a slide in this script?

Welcome everyone! Check out this piece of code I have: <script type="text/javascript" > $(function(){ var time = 10000;//milliseconds var index = 0; var container = $("#containerr"); var child ...

A guide to displaying numerous notifications using notistack in a React environment

I'm currently experimenting with React's 'notistack' module to showcase multiple notifications as a stack. However, it seems like I might be making an error since every time I encounter a warning: react_devtools_backend.js:3973 Warning ...

The workings of the toString() function within Objects

Recently while delving into a book on Js, I stumbled upon the intriguing topic of Object to primitive conversion. The author made an interesting point in the book: For historical reasons, if toString or valueOf returns an object, there’s no error, but ...

Develop a versatile currency symbol mixin that can be used in various small text formats

I am currently working on a website where I need to display prices in multiple locations. To achieve this, I have created a sass mixin that is designed to add the desired currency symbol before the price with a smaller font-size. Below are examples of how ...

The Ajax GIF Loader is not functioning in the latest versions of Internet Explorer and Firefox, but it is running smoothly in

The animated GIF loader functions correctly in the latest version of Chrome, but does not animate when viewed in IE and Firefox. Below is the code snippet: $("#DIALOG").dialog({ buttons : { "Yes" : function() { ...

Error: The index $_GET[...] is not defined

When transferring a javascript variable to a php file, I encounter an issue where $_GET['something'] keeps returning as an undefined index. Despite this error, the correct result is displayed and written into the xml. However, when I attempt to ...

Having difficulty stripping HTML tags from the response JSON

Hello, I am new to AngularJS and facing an issue with parsing JSON data. The JSON response contains HTML format data, with tags like <, BR, etc. When checking the response in a browser, it appears fine; however, on devices such as tablets or mobile phon ...

D3.js Issue: The <g> element's transform attribute is expecting a number, but instead received "translate(NaN,NaN)"

I encountered an error message in my console while attempting to create a data visualization using d3. The specific error is as follows: Error: <g> attribute transform: Expected number, "translate(NaN,NaN)". To build this visualization, I ...

Refresh all fields for various products with a single click of a button

Our Magento multi-vendor site allows vendors to easily manage their products. For each single product, vendors can view and update information such as price, selling price, quantity, and more from their vendor account. We have implemented a feature where ...

`How can we efficiently transfer style props to child components?`

Is there a way to pass Props in the Style so that each component has a unique background image? Take a look at this component: countries.astro --- import type { Props } from 'astro'; const { country, description } = Astro.props as Props; --- & ...

What's the best way to make div columns appear closer together when floating?

Check out My CodePen: http://example.com/codepen Hello there, today I am working on a 6-column layout with 3 columns in each row. The 3rd column is quite long and resembles a sidebar. According to the design, columns 4 and 5 should be positioned close to ...

I am unable to utilize third-party components within my Nuxt.js/vue.js project

I am attempting to use a library for my Nuxt project, following the guidelines laid out in the documentation available here: getting-started Despite following the instructions provided, I keep encountering errors such as "Unknown custom element: - did you ...

Is it possible to apply varying CSS styles depending on the parent element's class?

Apologies for the poorly worded question, but I am struggling to find the right terms to convey my query. Let me attempt to explain... Is it feasible to apply different css styles based on the classes assigned to the containing element? For example: < ...

Transform the € entity (which is stored in the database) into the € (Euro Symbol) within FPDF PHP

My MySQL database stores the euro symbol as "€", but when I display it in HTML, it shows as "€". Is there a way to convert "€" back to "€"? Here is the code snippet: function GetRate($NoPo){ global $dbname; $String = "SELECT ".$db ...