The scaling of the viewport does not seem to be functioning properly on the mobile device

As a beginner in website development, I am currently working on a new project that is still in the early stages of development. My goal is to ensure that this website is responsive for mobile devices. I have added the following meta tag

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
, but unfortunately, it doesn't seem to be working as expected. The only aspect that is functioning correctly is user-scalable=no. Despite trying various scale variations and different arguments, I have not been able to achieve the desired result. There may be an issue with the CSS. Any thoughts or suggestions would be greatly appreciated. Thank you.

function anim() {


            $(".slider").delay(1000).animate({
                width: 'show',

            }, 1000);

}

$(document).ready(function () {
    $('.carousel').carousel({
        pause:"false"

    })
})
body {
    overflow-y: scroll;
    overflow-x: hidden;
    background-color: moccasin;
}


.secondpic {
    margin-top: 10%;
    display: block;
    width: 100%;
    overflow: hidden;
    height: auto;
    position: relative;
}

arrow {
    margin-top: 10%;
    overflow: hidden;
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 30%;
    height: auto;
    position: relative;
}

#text {
    overflow: hidden;
    position: relative;
    text-align: center;
    bottom: 5vw;
    transform: rotate(-2deg);
    font-size: 1.9vw;
    color: #634731;
    font-weight: bold;
}

.slider {

    display: none;
    position: absolute;
    right: -60px;
    top: 0;
}

.container {
    margin-right: 0;
}

.navbar {
    top: -100px;
    white-space: nowrap !important;
    padding-top: 100px !important;
    float: right;
    background-color: transparent;
    padding-bottom: 0 !important;
    border-bottom: 0 !important;
    z-index: 10;
    right: 0;
    padding-right: 0;
    position: fixed;
    opacity: 1;
    margin: 0;
}

.buttons {
    padding-bottom: 0;
    margin-bottom: 0px !important;
    margin-right: -1px;
    -moz-transition: 0.2s linear;
    -ms-transition: 0.2s linear;
    -o-transition: 0.2s linear;
    -webkit-transition: 0.2s linear;
    transition: 0.2s linear;
}

.logo {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}

.text-white {
    padding-top: 15px !important;
    padding-bottom: 5px !important;
}

.bg-secondary {
    background-color: rgba(225, 159, 113, 1) !important;

}

buttons a:hover {
    background-color: orange !important;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">

    <title>Prosatin</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    
    <script defer src="js/bootstrap.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="http://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
            integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>
    <script src="website.js"></script>


</head>

<header>
    <div class="">
        <nav class="navbar navbar-expand-lg navbar-light slider">

            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup"
                    aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
                <div class="navbar-nav buttons">
                    <a type="button" class="nav-link p-3 mb-2 bg-secondary text-white buttons " href="#">FOTOGALERIE</a>
                    <a type="button" class="nav-link p-3 mb-2 bg-secondary text-white buttons" href="#">AKCE</a>
                    <a type="button" class="nav-link p-3 mb-2 bg-secondary text-white buttons " href="#">O NAS</a>
                    <a type="button" class="nav-link p-3 mb-2 bg-secondary text-white buttons " href="#">ZPEVNIK</a>
                    <a type="button" class="nav-link p-3 mb-2 bg-secondary text-white buttons" href="#">KONTAKTY</a>
                    <a type="button" class="nav-link p-3 mb-2 bg-secondary  buttons logo"
                       href="https://www.facebook.com/letnistanovytaborProsatin/"><img src="facebook.png"> </a>
                </div>
            </div>
        </nav>
    </div>
</header>


<body onload="anim()">


<div id="carouselExampleSlidesOnly" class="carousel slide" data-ride="carousel">
    <div class="carousel-inner">
        <div class="carousel-item active">
            <img class="d-block w-100" src="https://i.ibb.co/sjngKLM/tabor.jpg" alt="First slide">
        </div>
        <div class="carousel-item">
            <img class="d-block w-100" src="https://i.ibb.co/JHYhT9Z/DSC-7364.jpg" alt="Second slide">
        </div>
        <div class="carousel-item">
            <img class="d-block w-100" src="https://i.ibb.co/yS42F7s/im2.png" alt="Third slide">
        </div>
    </div>
</div>

<div>
    <img class="arrow" src="https://i.ibb.co/VM1v7kD/Image-5.png">
    <p class="" id="text">NEJNOVEJSI FOTOGRAFIE</p>
    <img class="secondpic" src="https://i.ibb.co/NjpppGn/Image-4.png">
</div>


</body>
</html>

View JSfiddle demo here

See incorrect layout on a phone

I'm experiencing some difficulties with getting the snippet and JSfiddle to work properly, but they should give you a general idea of how things are set up.

Answer №1

To ensure responsive design, it is essential to incorporate Media Queries in the following manner:

@media only screen and (max-width: 600px) {
  body {
    // your CSS styles here
  }
}

Answer №2

It appears there is a problem with the markup in your code. You have placed a <header> within the <html> tag, which is incorrect. The <html> tag should only contain two children: <head> and <body>. Therefore, the <header> should be nested inside the <body>. This could be the reason for any issues you are experiencing, as your meta tags seem to be correct. For more information on the structure of an HTML document, refer to this resource here (scroll down a bit).

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

Both if and else statements are carrying out code in JavaScript/jQuery

The second if statement is functioning correctly, but the first one always triggers the else statement and never stands alone. This jQuery function is enclosed within another function that is invoked under the "$(document).ready" command. I resorted to u ...

Update and modify content.php directly on the samepage.php rather than through externalpage.php by utilizing either Jquery or AJAX

Is there a preferred method for loading content on the same page instead of redirecting to an external page using AJAX or JQuery? Below is an excerpt from my external.php file: $id = null; if (!empty($_GET['id'])) { $id = $_REQUEST[ ...

Retrieve an object via a server's GET request

I am currently working with vanilla JavaScript using Node (HTTP) for the server side and XMLHttpRequest for the client side. I am uncertain about the process of sending an object that I have read on the server to the client. For instance, here is a snippe ...

What is the best way to create two divs separated by a forward slash?

I'm trying to create a menu that looks like the image, but I'm having trouble figuring out how to divide the two divs and make them clickable. I've experimented with using SVG and borders on the divs, but I can't seem to get them to wo ...

Setting up Webpack for Node applications

My current challenge involves configuring Webpack for a node app that already exists. I am encountering various issues and struggling to find solutions or even know where to begin. Situation The project's folder structure is as follows: +---app +-- ...

Authorization missing in Select2 Ajax request

Encountering an issue while attempting a get request to a secure endpoint that requires an Auth token. Despite fetching the token asynchronously from chrome.storage, it fails to be included in the ajax request and results in a 401 error ("Authorization hea ...

Arranging JavaScript object by object properties (name)

Can anyone assist me with my training? I am currently learning JavaScript (Js) and TypeScript (Ts) by working with an external public API. After successfully fetching and displaying my data, I now want to implement sorting functionality. My goal is to sor ...

Tips for incorporating fixed div columns within ngFor?

I need help implementing a design where I have a dynamic array of data that I want to display in 3 bootstrap columns per row like the following: <div class="row"> <div class="col-md-4"> <a>data</a> <a>data</a> ...

Struggling to retrieve a property value from an object in JavaScript

I am having trouble reading an Object property that I retrieved with MongoDB while working with MeteorJS. The object creation process is as follows: header = ["name"]; values = ["word1", "word2"]; var tmp = {}; var data = new Array(); for (var cnt = 0; cn ...

The method contents().find('html').html() does not apply the style rules to the body

I'm currently facing a minor issue with my code. The problem arises when I attempt to set the content of an IFRAME using contents().find('html').html(). For instance, when using this code snippet: <html> <head> <s ...

Error caused by Array.prototype

I am currently working on integrating w2ui multi select feature into a d3 chart project. You can find a sample showcasing the issue in this jsfiddle link. There are three functions that I have: // Retrieve a column from an array Array.prototype.getColum ...

The issue of Firefox background image flickering is persistent when multiple instances are open and the background-size

I am facing an issue with background images on my webpage. I have two elements that share a background image and are contained within 3 column width containers using Bootstrap. In the second element, I have set the background to be 90% in width, making it ...

Tips for determining which site was accessed

My store is linked to a grid and when it loads, it has multiple pages. Now, I need to display the page that contains a specific value. To achieve this, I make use of store.load({params: {'file': 'file33939'}});. Despite not knowing the ...

Associate information from a modal to a knockout model

I am attempting to utilize a Twitter Bootstrap modal that opens a window containing an editable text area. Upon saving, the relevant data should be saved. The current code I have is as follows: HTML: <table class="display table table-striped"> ...

Is there a way to retrieve the values for North, East, South, and West separately?

let coordinates = [ { mapview_id: [ { west: 11.5, south: 55.75, east: 12, north: 56, }, ], }, ]; I'm encountering a constant issue with this data retrieval process. Every attempt to access the d ...

Is there a way to automatically redirect my page after clicking the submit button?

I'm having trouble with the code below. I want it to redirect to NHGSignin.php if 'new horizon gurukul' is entered. When I click the Next button, it's supposed to take me there but it's not working as expected. Can anyone help me f ...

The `indexOf` function cannot be properly executed within a Vue mutation if the action involves a promise

I'm facing a challenge with using indexOf inside a vuex mutation when calling an action that returns a promise. Here is the action code: export const deleteItem = ({commit}, item) => { return new Promise((resolve, reject) => { Vue.h ...

Tips for adjusting the admin panel's content area to fill the entire width

I am currently working on HTML code for an admin panel. Here is a basic structure: body {margin: 0} .adminpanel { display: flex; height: 100vh; } .leftpane { width: 250px; background-color: #0038a8; } .rightpane { width: 87%; backgrou ...

What is the method for adjusting the border color of an ng-select component to red?

I am having an issue with the select component in my Angular HTML template. It is currently displaying in grey color, but I would like it to have a red border instead. I have tried using custom CSS, but I haven't been able to achieve the desired resul ...

display data from a hashmap in a React component

Struggling with extracting data from a hashmap retrieved from an API for my React application. Here's a snippet of the data: [ [ "d243dc7-6fe8-151b-4ca8-1be528f2b36", "[\"Jonny\",70]" ], ...