Experiencing difficulties with CSS styling for mobile displays

Whenever I check my React app on mobile devices, I notice an extra space on the right side of the screen:

Interestingly, this extra space is not visible when I use developer tools to emulate a mobile view. However, when I access the site through various mobile browsers, the space appears and the app fails to automatically adjust.

Below is the CSS code within my media query configuration:

@media all and (max-width: 414px) {
  .ImageCard,
  #CardImage {
     width: 314px;
  }
  #CardImage {
    height: 314px;
  }
  ul {
    font-size: 1.2rem;
    padding: 0 15px;
  }
}

Answer №1

The problem seems to be caused by the element

<input accept="image/*" name type="file">
.

If I hide .fileContainer input using display: none, the extra space disappears.

Update

Upon further investigation, it appears that semantic.min.css is setting a font-size: 100% on elements like

button, input, optgroup, select, textarea
. This is causing the input field to expand in size (see image when visible):

https://i.sstatic.net/YisbA.png

If we remove the font-size: 100% style, the input displays correctly:

https://i.sstatic.net/3pZJ2.png

Once this change is made, your original styles will function as intended:

https://i.sstatic.net/N2DEV.png

Therefore, either applying display: none or reverting the font-size adjustment will solve the issue :)

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

Quick way to access dropdown menu in Visual Code while selecting JavaScript/React code

While working on React code in Visual Studio Code, I accidentally triggered a dropdown menu when trying to copy and paste a section of my code. One of the items that caught my eye was labeled "Destructure JavaScript," which seemed intriguing. Unfortunately ...

Experiencing the recurring issue of "TypeError: Unable to access property 'map' of undefined" while implementing the map function in ReactJS

I can't seem to figure out what's causing the issue I'm facing with my code. Let me provide some context for the code snippets below. Within the Slider component, I'm receiving the storeList from the parent component as props and passi ...

Separation between inline elements with a line break

I am faced with the challenge of placing the a tag on a new line while maintaining center alignment, without being able to modify the HTML. The display:block option extends the clickable area beyond the text. See the screenshot below for the desired outco ...

Potential Bug Detected in Internet Explorer on Mouseenter Event

I'm facing a challenge with my HTML/CSS code. I have a carousel that includes two li elements positioned absolutely on each side for navigation but they are not displaying correctly in IE versions 7-9 - they appear behind the main element regardless o ...

Is it possible to dynamically load a specific div when the page loads, relying on the

I am using JQuery SlideUp and slideDown methods to toggle the visibility of panels. How can I load or display the first record's contact information as a default? Currently, it loads blank because I set the panel's display property to none: < ...

How can I customize the <span> element created by material-ui?

Is there a way I can customize the appearance of the <span> tag that is produced when using the Checkbox component from the material-ui library? Essentially, I am seeking a method to alter: <span class="MuiButtonBase-root-29 MuiIconButton-root-2 ...

Obscured Background Beneath the Bootstrap Tip

Desired Outcome: I am aiming to achieve a blurred background behind the tooltip element. https://i.sstatic.net/AE1RQ.png Current Status The current state shows that the area behind the tooltip is not blurred as intended. https://i.sstatic.net/bE57E.pn ...

Flex-wrap functionality in versions of Safari 6 and earlier

As I work on developing my website, I have been using flexbox to assist with the layout. It has been functioning well on most browsers, but I have encountered issues with Safari versions below 6.1. Specifically, I am struggling with flex-wrap as I want the ...

Tips for resolving Error 400 when images are not appearing in the Next App utilizing Firebase Server-Side Rendering

Currently navigating the process of deploying my ssr app on firebase and making progress. Encountering an issue with my images - a 400 error message is appearing in the console. The images are sourced from an external URL, and although the data is being f ...

Preserving the tally within a React useEffect

I am currently exploring the utilization of react hooks with effects and state in my projects. Within my application, I have implemented text with both up and down voting options. function Overview() { const [countUp, setCountUp] = useState(0); ...

Pagination feature in MUI DataGrid table is malfunctioning

I'm struggling to get the pagination feature to work in my Material UI DataGrid component, but I'm hitting a roadblock: https://i.stack.imgur.com/eT7s7.gif The console is not showing any errors. Here is the code for my component: import { ...

Adding alpha or opacity to the background image will give it a unique and

Is there a way to darken the background image while keeping the text color the same? Check out this code snippet on JSFiddle div { display:block; background:url('http://placehold.it/500x500') 0 0 no-repeat; background-color:rgba(0 ...

Experiment conducted to test variations of elements in Google Optimize resulted in duplicate rendering in a React/Nextjs application

Within my React/Next.js application, I have implemented code to utilize Google Optimize. The debug for the optimization indicates that the experience is rendering correctly and when previewing the a/b test, it displays correctly as well. However, upon se ...

Component TypeScript error: Unable to reference forward ref

Struggling to pass a ref to my search component with no luck. Here's the component code: interface SearchInputProps { placeholder: string; onSearch: () => any; } // type TextInputProps = React.HTMLProps<TextInput>; export const SearchIn ...

The logo image in the React application is having trouble rendering, showing a "Module Parse Failed" error

I am facing an issue while trying to render an image in my React component. The problem arises when I attempt to load and display my Logo within the component. A parse error is being thrown, and I am unsure of the reason for this error: Uncaught Error: Mo ...

What is the proper way to enable the Google Analytics cookie only once another consent cookie has been set and is marked as "true"?

I am currently using React/Nextjs on my website along with the react-cookie-consent library. This setup generates a pop-up where users can agree to the cookie policy, and if they do, a CookieConsent with the value "true" is set. In addition to this, I wis ...

I am experiencing difficulty in passing parameters to nested navigators

I have developed a TechInfo page and a ProfileInfo page. The ProfileInfo Page is nested inside a Drawer Navigator. I want to display some information from the TechInfo page and some from the ProfileInfo page when I enter our info and press a button. Howeve ...

Ensuring Consistent Data in Web Forms When Editing a User's "Points" Field

In the process of creating a booking system, I am faced with an issue regarding how points are allocated to users. An admin can assign points to a user through a form, which the user then uses when booking a slot. The problem arises when the admin opens th ...

Can you identify the animation being used on this button - is it CSS or JavaScript?

While browsing ThemeForest, I stumbled upon this theme: What caught my eye were the animation effects on the two buttons in the slider ("buy intense now" and "start a journey"). I tried to inspect the code using Firebug but couldn't figure it out com ...

What is the best way to retrieve data in Server Components?

In my current process of handling fetch, I am following the guidelines outlined in the document below: https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#fetching-data-on-the-server-with-fetch async functi ...