What is causing my ReactJS website to appear unrecognizable when viewed on a mobile device?

I have just finished creating my own website, which I put a lot of effort into. While it appears normal on a computer screen, it looks completely disorganized when viewed on a cellphone. This is the first website that I have ever built, and I was eagerly looking forward to seeing it on a mobile device only to be disappointed by how chaotic it appeared.

Below is the content of my index.html

<!DOCTYPE html>
<html>

  <head>
     <title>Website</title>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1">
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

     <link rel="stylesheet" href="index.css">
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
     <script src="https://unpkg.com/react@15/dist/react.js"></script>
     <script src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.16/browser.js"></script>
  </head>

  <body>
    <div id="firstBar"></div>

    <script type="text/babel" src="index.js"></script>

  </body>

</html>

The contents of my index.css file are as follows:

// CSS code here...

This snippet shows what's inside my index.js file:

// JavaScript code here...

Answer №1

One possible reason could be that your website is not designed to adapt to different screen sizes

If this is your first project and you are new to web design, don't worry - we all start somewhere! It sounds like the main issue you're facing is that YOUR WEBSITE IS NOT RESPONSIVE. To address this issue, you can try looking up information on responsive web design through a quick search online.

Some helpful resources to look into include using plugins like bootstrap or studying css media queries for creating a responsive layout.

Unfortunately, I cannot provide you with a solution specific to your website as it would involve creating an entirely new one, which is beyond the scope of this platform.

Make sure to check out more information on responsive-design to further enhance your understanding.

I hope this provides some help in addressing your concern. Good luck!

Answer №2

It seems that your website is facing some disarray due to a combination of Bootstrap elements and manual styling decisions. The lack of consistency in your approach has led to a wonky layout on both desktop and mobile devices. You've used Bootstrap for certain components but overlooked the grid system, resulting in style clashes and misalignment issues.

To address these challenges, I recommend diving deeper into Bootstrap's documentation to understand how the grid system works. By adhering to best practices and utilizing Bootstrap features correctly, you can enhance the structural integrity of your site without resorting to excessive manual coding or style overrides.

Answer №3

Don't expect magic to happen just by installing bootstrap on your website — it won't automatically make it responsive.

The key to achieving a responsive design lies in utilizing Bootstrap's grid system, which offers a structured way of creating responsiveness. Take a look at this simple example showcasing the power of Bootstrap's grid system:

<div className="container-fluid">
   <div className="row>
      <div className="col col-xs-12 col-md-6 col-md-offset-3"></div>
   </div>
</div>

By using the 'col' class properties in Bootstrap, you can effortlessly add responsive styles to your layout.

In my recent projects with React, I've found great success in using react-bootstrap. This library simplifies the process of leveraging Bootstrap within React applications, making frontend development more dynamic and efficient. Here's an example of how you can implement a similar grid structure using react-bootstrap:

import { Grid, Row, Col } from 'react-bootstrap';

<Grid fluid={true}>
   <Row>
      <Col xs={12} md={6} mdOffset={3}></Col>
   </Row>
</Grid>

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

The influence of the CSS transform property on one element can impact another element that also has the transform property set to scale down to 0

When the transform property is added to div.tp-banner, the border of div.tp-border-bottom disappears. However, setting the height of div.tp-border-bottom:after to 2px makes it visible. This issue is observed on the Android WebView platform. .tp-banner { ...

create a hexagon-shaped video player

Does anyone know of a video player that can take on unconventional shapes like a hexagon or other unique designs? YouTube doesn't seem to offer this feature - is there a Flash or HTML 5 player out there that can accommodate customized video shapes? ...

Console not displaying any logs following the occurrence of an onClick event

One interesting feature I have on my website is an HTML div that functions as a star rating system. Currently, I am experimenting with some JavaScript code to test its functionality. My goal is for the console to log 'hello' whenever I click on ...

Is automatic login possible using JQuery Ajax?

Hey there, I'm trying to figure out how to create an auto login page using JQuery ajax. I want it to include a countdown feature as well. The goal is to speed up my testing process and eventually use these skills for other HTTP requests in various pro ...

Checking for non-falsy variables that include 0 in JavaScript

What is a more graceful method for checking if a variable is truthy but also passes when it's equal to 0? The current verification if(var !== undefined && var !== null) is lengthy and doesn't account for all scenarios such as undefined or ...

Retrieving data from checkboxes and radio buttons using ng-repeat

my JSON data [ { "id": "583e75080c842b17e7df1628", "product_name": "Pizza", "product_price": 100, "product_max_quan": 10, "checkbox_value": [ { "_id": "checkbox_1", "i ...

Damaged .xlsx document originating from a Flask web application and an ajax POST submission

I've encountered an issue with my Flask web app where a URL route receives a post request containing JSON, converts it to an .xlsx file, and returns it using send_file(). On the server side, the generated .xlsx file appears to be correct. However, wh ...

Steps for displaying a customized view within an NPM module:

Given that pushAsset prohibits loading external resources, I am interested in displaying this template/script from my NPM module: views/tag.html <script async src="https://www.googletagmanager.com/gtag/js?id={{ data.gid }}"></script> NPM mod ...

Retrieve custom attributes of child elements using jQuery selectors

I am looking to modify the data-answersetid attribute of all child controls under the .cloneable class in a table. Each row in the table contains a single control - either a textarea, checkbox, radio button, or input[type=number]. Each control has a custom ...

retrieve all users who are not currently in the group

I'm currently struggling to retrieve all users who are not members of a particular group within a many-to-many association. After investing several hours into researching and experimenting, I've developed the following code. However, it falls sh ...

Embedding @keyframes within @media queries

I need to resolve an issue involving curly brackets. However, all opening brackets have a corresponding pair. There is an error on line 212 Expected RBRACE at line 212, col 2. @-webkit-keyframes move { Oddly enough, when I test the code separatel ...

Tips for showcasing mistakes when submitting a form

I am curious about how to show the error message from my model in the validate() function if the submit is not valid, returning "invalid username or password" index.scala.html @(myForm: Form[models.profile.MUser]) @import helper._ @import helper.twitter ...

Displaying numerous Google Analytics graphs within a single webpage

Incorporating Google Analytics charts into my dashboard has been a challenge. Each chart is displayed as a widget that can be added or removed from the dashboard at will. The issue arises when I try to add more than one chart - they no longer display prope ...

Encountered an unforeseen token "<" that is causing the server to return a 404 HTML page instead of the intended .js

I am currently developing a to-do list application using Node.js Express and EJS. In the app, I have implemented a filtering functionality with a URL path of "/filter/query". Based on the selected category (either "lists" or "lastupdated"), the app filters ...

Use regular expressions to split a number string based on the individual digit values

Is it possible to use regex to split a string that consists only of numbers based on matching digit values? Take for instance this input: "11222344" The expected output should be: ["11","222","3","44"] ...

Transform a dynamic list object in a form into JSON using javascript

I have been using a form submission script that converts form inputs to JSON and submits with ajax. It has worked well for simple forms in the past, but I am encountering an issue when trying to use it for lists. Within the form, there is a dynamic list o ...

The reason for variation in the width setting for input elements

I've been scratching my head for a while now trying to figure out why the width of input elements isn't setting correctly. In this example, I set the width to 100px for the submit button But in this one, I also set it to 100px for the text fie ...

Issue with the hamburger menu dropdown color not being applied properly

Greetings to all who are taking the time to review this query! Everything seemed to be going well until I refreshed my code after making numerous changes, and then this issue arose: Dropdown menu lacking color: https://i.sstatic.net/3lz5a.png The color ...

Display DataTable in a JavaScript alert message

... { foreach (ListEntry.Custom listrow in mySpread.Elements) { DC = myTable.Columns[listrow.LocalName] ?? myTable. Columns.Add(listrow.LocalName); myDR[DC] = listrow.Value; ...

Issues with the alignment of ion-grid in Ionic/Angular application

I am facing an issue in my ionic/angular project where I am attempting to create two columns within a row using ion-grid, ion-row, and ion-col. However, the content of the second column is unexpectedly appearing below the first column instead of beside it. ...