The appearance of HTML dropdown select options is unappealing when viewed on iPhones

Looking for a simple alternative to the dropdown menu implementation on iPhones/iOS for a mobile website (not native app). Any suggestions using HTML/CSS/JavaScript?

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scaleable=no, width=device-width" />
</head>
<body>
<font size=+1>
<select>
<option disabled selected value="select">Choose a category</option>
<option value="toyota">Toyota</option>
<option value="honda">Honda</option>
<option value="ford">Ford</option>
</select>
</font>
</body>
</html>

Answer №1

<html>
<head>
/* code by Sarah Thompson */
<style>
ul#main-menu, ul#main-menu ul.sub-menu {
    padding: 0;
    margin: 0;
}
ul#main-menu li, ul#main-menu ul.sub-menu li {
    list-style-type: none;
    display: inline-block;
}
/*Styling Links*/
ul#main-menu li a, ul#main-menu li ul.sub-menu li a {
    text-decoration: none;
    color: #fff;
    background: #666;
    padding: 5px;
    display: inline-block;
}
/*Make parent of sub-menu relative*/
ul#main-menu li {
    position: relative;
}
/*Sub Menu*/
ul#main-menu li ul.sub-menu {
    display: none;
    position: absolute;
    top: 30px;
    left: 0;
    width: 100px;
}
ul#main-menu li:hover ul.sub-menu {
    display: block;
}
</style>
</head>
<body>
<ul id="main-menu">
    <li>
        <a href="#">Menu 1</a>
    </li>
    <li><a href="#">Menu 2</a>

        <ul class="sub-menu">
            <li>
                <a href="#">Sub Menu 1</a>
            </li>
            <li>
                <a href="#">Sub Menu 2</a>
            </li>
            <li>
                <a href="#">Sub Menu 3</a>
            </li>
            <li>
                <a href="#">Sub Menu 4</a>
            </li>
        </ul>
    </li>
    <li><a href="#">Menu 3</a>

    </li>
    <li><a href="#">Menu 4</a>

        <ul class="sub-menu">
            <li>
                <a href="#">Sub Menu 1</a>
            </li>
            <li>
                <a href="#">Sub Menu 2</a>
            </li>
            <li>
                <a href="#">Sub Menu 3</a>
            </li>
            <li>
                <a href="#">Sub Menu 4</a>
            </li>
        </ul>
    </li>
    <li>
        <a href="#">Menu 5</a>
    </li>
</ul>
</body>
</html>

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

Explaining the Usage of Nav-pills in Bootstrap v4

I am looking to align my navigation bar across the width of the div. However, I am currently using Bootstrap v4 and the nav-justify class is not available yet. Below is the code snippet: <ul class="nav nav-pills"> <li class="nav-item"> ...

AngularJS: Substates not rendering properly

I'm encountering issues while trying to incorporate nested states in my project. Although the View template and JavaScript calls are being made and loaded, the screen is not changing - in other words, the nested screen is not displaying. http://{dom ...

Fluid image background failing to display properly in Firefox browser due to CSS compatibility issues

I'm currently working on implementing a fluid image background for one of my webpages. It's functioning perfectly in Chrome, but I can't seem to get it to work in Firefox. The goal is to have two squares with PNG images that resize proportio ...

Encountering Timeout Issues with Reading Streams on Amazon S3 using Express.js

I am currently facing an issue with streaming videos from an Amazon S3 Bucket. It seems that everything works perfectly when calling my REST endpoint once, but the problem arises when trying to stream the video simultaneously from multiple browsers. The er ...

What is the method for updating the form action to alter the hash without causing a page reload?

My website is designed to show dynamic data based on the information following the '#' in the URL. Surprisingly, when I manually change this value in the URL, the page doesn't reload. However, if I modify it within a form on the site, the we ...

Safari: The onbeforeunload event

Welcome! To experience the Leave | Stay confirmation box on your page, please make sure you are using Safari 10. I am currently facing an issue with getting the confirmation box to display properly across different browsers. To begin, please visit and l ...

AngularJS: Utilizing $http to fetch XML data instead of JSON

Looking to extract data from a website using angularjs / javascript. I am familiar with the $http object in angularjs which can make get requests. I have used it before to retrieve json, but I'm wondering if I can use it for XML (HTML) as well? (I th ...

Mark scheduled specific time periods

I need help removing booked time slots from the total time slots. How can I achieve this? Input: Actual time slots: [ '10:00-10:30', '10:30-11:00', '11:00-11:30', '11:30-12:00', '12:00-12:30', ...

Using Regular Expressions to access a deeply nested object

Within my JS objects, there is a common grandchild property called 'products'. For example: ecommerce.add.products, ecommerce.remove.products, ecommerce.detail.products, ecommerce.checkout.products, ecommerce.purchase.products I am attempting t ...

How can I remove the outline when focusing with the mouse, but still retain it when focusing with the

Is there a way in JavaScript to detect if an element received focus from the keyboard or mouse? I only want the outline to show when it's via the keyboard, not the mouse. If this is possible, how can I override the browser's default outlining be ...

Hinting the type for the puppeteer page

I am trying to type hint a page variable as a function parameter, but I encountered a compilation error. sync function than_func(page:Page) ^ SyntaxError: Unexpected token: ...

Understanding the Submission of a Form upon the submission event

On my form, I have multiple buttons - two of them use ajax to submit the form and clear it for adding multiple records, while the last button is for moving onto the next page. I'm wondering if jQuery's .submit() method can determine how the form ...

"Troubleshooting: ngForm.controls returning undefined value in Angular application

Trying to test this HTML code in Angular: <form name="formCercarUsiari" #formCercarUsuari="ngForm" class="tab-content"> <input #inputNif class="form-control input-height" maxlength="100" type="text" placeholder="Indiqui NIF" name="nif" i18n-pla ...

Exploring the functionalities of JavaScript methods and nested components within Vue.js

Learning Vue.js has been an interesting experience for me. However, I am facing challenges with methods and child elements in the library. It seems like there is something simple that I am overlooking. In my current project, I have list items rendered on ...

Issue with AjaxSetup overlapping with jqgrid

How can I set up global AJAX calls using ajaxsetup without interfering with the functionality of jqgrids on my website? I want to apply the code below to my AJAX calls, excluding those related to jqgrids. $.ajaxSetup({ type: "POST", contentType: ...

The iPhone's MPMediaPlayer lost connection with the server and cannot be reestablish

Is there a way to detect and handle this notification? _serverConnectionDiedNotification. Info -- notification=NSConcreteNotification 0x2e7f70 {name = AVController_ServerConnectionDiedNotification; object = <AVController: 0x2aa2a0>}, AVController = ...

React does not accept objects as valid children

Currently, I am working on developing a stopwatch using reactive js. Here is the code snippet that I have been working on: <div id="root"></div> <script src="https://unpkg.com/library/react.development.js"></script> <script sr ...

Obtaining the value of an object within a NSDictionary containing multiple keys

After receiving a string from a NSURLRequest, I deserialize it to convert it into a NSDictionary using the following code: NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; if ...

Utilize $http.get within a service/factory to retrieve a set of items

I am trying to utilize a http.get promise within an angularjs service, perform some manipulation on the retrieved collection, and then pass it back to a controller... My query is regarding the proper usage of $http.get() in a service to fetch and modify t ...

Having difficulty compiling a Swift project in Xcode on my iPhone

Last year, I developed a basic game that I eventually abandoned. Recently, I decided to revisit the project and encountered an issue when trying to build and run it on my iPhone after successfully doing so using the Simulator. Despite having a developer li ...