`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 Vue to display a Div inside a TD element of a table does not result in a reactive behavior

I am encountering an issue with a table where the last column contains a div with three options (View, Edit, and Delete). This submenu is initially hidden, but when clicking on the options button in the last column of the table, the array used to control i ...

Using JavaScript to display a confirmation dialog box with the content retrieved from a text input field

Can a confirm dialog box be used to show the user-entered value from a form's text box? For instance, if the user enters 100.00, I want the dialog box to say something like, "Confirm Amount. Press OK if $100.00 is accurate." ...

Activate the Chrome Extension that allows you to open a link in a new tab with just a middle click or regular click, without closing the popup

When I try to click a link in my extension popup and open it in a new tab using "middle click -> open link in a new tab", the popup closes. Is there a way to keep the popup open so I can click on multiple links from my extension without interruption? Any ...

Incorporating an NPM module with dependencies within the Meteor framework

I'm encountering some difficulties while attempting to integrate an NPM package into my meteor project. The specific module I am trying to utilize is the steam package. In order to make this work, I have included the meteorhacks:npm package for mete ...

Update image attributes (such as src, alt, etc.) after a successful AJAX request (and also help me troubleshoot my AJAX

The image link I am currently using is: echo "<br/><div class='right' id='post" . $id . "'> <img id='thumb' src='/images/like.png' title='Like it?' alt='Like button' onC ...

Ensuring the container height remains consistent with fluctuating content dimensions

Imagine a container with content, where the container's width is fixed but its height adjusts based on its inner content. Initially, when the content causes the container to be a specific height, the challenge arises in shrinking the inner elements w ...

Utilizing d3 Charts in Angular 4 Framework

I need assistance with integrating a bar chart in an Angular 4 project, which includes HTML and TypeScript files as components. Can someone please provide guidance on this? The bar chart should show the increase in the number of employees each month, star ...

Exploring Ngu-Carousel in Angular 7: Importing JSON data for a dynamic display

After attempting to import data from JSON and display it using ngu-carousel, I encountered an error. The error shows "length of undefined" Subsequently, when I try to click on the previous/next button, another error appears. This error states "innerHTML ...

Using ejs-locals in Express.js to insert script tag with data

Using ejs-locals for express 3.x (https://github.com/RandomEtc/ejs-locals) How can I add a script tag with dynamic data in a template? In my layout.ejs file, I currently have: <%- block.scripts %> In my page template login.ejs, I want to replace ...

Achieve a responsive layout by dynamically sizing child div elements to fill their parent container using percentage-based margins and

I'm having trouble getting the child divs to stretch to the parent, and I'm not sure if I need to specify a % width on #fullpage-content even though #middle is set to 76%. I seem to have forgotten... Would you like to check out this link where c ...

The tooltip feature for icon buttons within Material UI list items is not functioning properly as anticipated

Just starting out with Material UI and React, I've encountered a strange UI problem that I can't quite figure out. Hopefully someone here can help me identify what I did wrong. My Approach: I have a List in my code where each list item has butto ...

What is the fastest way to invoke the driver.quit() method in Selenium?

Is there a way to force close the browser immediately instead of waiting for it to complete loading before calling driver.quit()? ...

What is the best way to remove the box-model from an element?

Within my VueJS project, I am faced with nested elements that are generated dynamically like this: <container> <outerElement class="outer" v-for="obj in objects"> <innerElement class="inner" v-for="el ...

Exploring i18nNext integration with antd table in React

Presently, this is the UI https://i.stack.imgur.com/CMvle.png App.tsx import "./styles.css"; import MyTable from "./MyTable"; export default function App() { const data = [ { key: "1", date: "2022-01- ...

What is causing the issue with CSS properties and media queries not being effective on specific elements?

I have been experimenting with React and SCSS to create a portfolio page. Although I am familiar with these tools, I recently encountered issues where certain style changes were not reflecting in the browser. One specific problem involved styling the head ...

Is there a way to generate unique authentication numbers daily without the need to manually adjust any code

I am building a web application for commuters using vuejs and firebase. My goal is to implement the following feature: The employer provides the employee with a unique authentication code daily, which the employee (user) must enter when clicking the "go t ...

I am looking to adjust the height of my MUI Grid component

Recently exploring React, and I'm looking to set a height limit for MUI Grid. I've structured my project into 3 sections using MUI grid components. My goal is to restrict the page height in order to eliminate the browser scrollbar. If the conten ...

Automatically scroll the chat box to the bottom

I came across a solution on Stackoverflow, but unfortunately, I am having trouble getting it to work properly. ... <div class="panel-body"> <ul id="mtchat" class="chat"> </ul> </div> ... The issue lies in the JavaScript t ...

Self-moving button container

I have a challenge involving a button and a sliding div. When the button is clicked, I want the div to slide. The problem arises when I place the button inside the sliding div - it ceases to slide. I understand the issue at hand, but I'm unsure of ho ...

Encountering issues with implementing useStyles in Material-UI components

Currently, I am working on a project utilizing Material-UI's library and encountering styling issues. This project marks my initial venture into ReactJS and JavaScript in general. Therefore, any assistance would be greatly appreciated! I am struggli ...