Setting up navigation bar for iPhone 8 screen dimensions

When viewing my JavaScript game on an iPhone 8, the navbar/stripe displaying modes and results doesn't show all items on one line. Instead, it causes the last mode (hard) to drop to a second line. I've attempted various resizing and flexbox options, but can't seem to find a solution. Any assistance would be highly valued.

See below for the HTML code:

<div id="stripe">
    <button id="reset">New Colors</button>
    <span id="message"></span>
    <button class="mode">Easy</button>
    <button class="mode selected" class="selected">Hard</button>
</div>

Check out the CSS code as well:

#stripe {
    background-color: white;
    text-align: center;
}

#message {
    display: inline-block;
    width: 20%;
}

@media (max-width: 480px) {
  #container {
    margin-top: 10px;
  }
  #colorDisplay {
    font-size: 100%;
  }
}

Answer №1

Here is a flex-based solution you can experiment with:

#wrapper {
    display:flex;
    justify-content:center;
    align-items: center;
    
    background-color: lightgrey;
}

#content {
    flex-basis: 25%;
    text-align: center;
}
<div id="wrapper">
    <button id="resetColors">Refresh Colors</button>
    <span id="content"></span>
    <button class="mode easy">Simple</button>
    <button class="mode challenging selected">Difficult</button>
</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

Collect data from website submissions via email

Is it possible to receive the results via email when someone submits their details on my site using a script? My server does not allow .php or .asp files, only .css. How can I achieve this? ...

Enhance your HTML audio player with added timeline functionality

I'm currently working on incorporating an HTML audio player into my project. I've managed to get the play/pause functionality to work, but now I'm stuck on adding a timeline feature. Additionally, I'm not sure how to implement the play/ ...

What is the best way to find out the exact height of the viewport or window on mobile browsers?

When working on my computer or PC, adjusting the height of a div to match the window size is simple. I just use the following CSS code: div{ height: 100vh; } But when viewing the same page on mobile browsers, the div's height extends beyond the vie ...

Is it possible to achieve wordpress + nginx + https for just a single page?

I am facing a challenge with my WordPress site, which is hosted on Nginx running on Windows Server 2012 R2. I want to enable HTTPS on specific pages like /cart/, /my-account/, and /checkout/, but all the resources are still being loaded over HTTP, resultin ...

In what way can the name of an event be made dynamic in a Node.js environment?

I am currently working on creating a dynamic EventEmitter in Node.js. I am wondering how to have the event name change dynamically. See the code snippet below: const express = require('express'); const app = express(); const server = require(&a ...

Tips on replacing views within ion-view and updating the title in the title bar to match the injected page through the use of Ionic and AngularJS

I am new to ionic and angular JS. I am currently working on a simple app within the ionic framework. My goal is to inject an HTML template into the ion-view tag using ngRoute. However, I am facing issues as my code is not successfully injecting the HTML te ...

Ways to customize the appearance of a specific column in a k-grid td

While working with a kendo grid, I encountered an issue with setting a tooltip for one of the columns. After some experimentation, I discovered that in order for the tooltip to display correctly, I needed to override the overflow property on the k-grid td ...

Ways to decrease the spacing between lines in a table row

I am trying to decrease the line height between table rows, but the code I used didn't work. Can you please take a look at the image? Specifically, I want to reduce the space between "Mon-Sat 09:00 AM - 7:00 PM" and "We closed Sunday &a ...

Having trouble dividing an HTML file?

Currently, I am working on creating a very basic web page that is divided into two parts. Each part will have its own HTML file: Welcome.html & Welcome.css: <html> <head> <link rel="stylesheet" type="text/css" href="Welcom ...

Interactive feature in Three.js causes page to scroll downwards upon object selection

Exploring Three.js for the first time, I'm looking to integrate it into the landing page of my website. However, I've encountered an issue where clicking on the scene area with my object causes the page to shift downward. I've tried adding o ...

Implementing Navigator.replace with NavigationStateUtils in React Native + Redux: A Step-by-Step Guide

I have a question about my navigation implementation in navReducer.js. Currently, I have the logic to handle .pop and .push using NavigationStateUtils. However, I want to implement .replace functionality where it replaces the current scene with a new rou ...

Ways to generate a fixed-length string without relying on the rand() function

Is it possible to create a fixed length string without relying on the rand() function? I currently have a method for generating random strings, but I would prefer not to use the rand() function function generateRandomString($length =6) { $characters ...

The single answer input field is not displaying as a readonly text input

Here is a jsfiddle link Please pay attention to Question 2 in the jsfiddle table, as it contains only one answer. In the jquery function, I have attempted to make the text input under the Marks Per Answer column readonly if a question has only one answer ...

Updating Bootstrap Indicators with jQuery on Click Event

Unfortunately, I am unable to share an image due to limited internet data. My goal is to switch each image to its sprite equivalent. There are three list items that I'm struggling to change because they each have two classes that need to be updated. ...

The aligning property "justify-content: space around" does not behave as expected on a line and does not provide the desired spacing

Below is the HTML code I am working on: <!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta na ...

Interested in creating a weather application that changes color based on the time of day

My attempt to create a weather app with a glowing effect has hit a roadblock. I want the app to glow "yellow" between 6 and 16 hours, and "purple" outside of those hours. I have assigned classes for AM and PM elements in HTML, and styled them accordingly i ...

Validating button using Java's jsoup library

Looking to determine if a page has a next button for scrolling. The approach is simple: extract the current link, remove the index at the end, replace it with a new index, attempt to connect to the updated link, and if an IOException is thrown, then ther ...

The Bootstrap image column is not aligning in a straight line

For a project, I need to create inline images like the following: https://i.sstatic.net/J3oep.png This is my code snippet: <div class="col-lg-6"> <h2>Exchange</h2> </div> ... When I expected them to be displayed inline, the ...

Using JQuery for sliding left without having to use inline CSS

I am dealing with a situation on my website where I need to hide a sidebar when clicked. $('#sidebar').toggle('slide', 'left', 300) In addition, I have implemented a CSS style to hide the sidebar on mobile devices. #sidebar ...

What steps should I take to create a script that can manipulate elements of a webpage when a specific DIV is visible on the screen?

I am working on customizing the carousel on my website roseannebarr.tumblr.com. My plan is to add a dedicated "About" button on the left side of the carousel. When this button is clicked, I want a "left" arrow to appear in its place. I am new to Javascri ...