The flex-direction property is not behaving as anticipated in the Chrome browser

Hi everyone, I really need some assistance with my code. The flex-direction property is not working for me no matter what I try. I've tested it on both Chrome and Microsoft Edge, but it displays the same result. I've been stuck on this for the past two days. Currently, I'm following a tutorial on creating responsive web design on YouTube. Interestingly, when I copy the source code directly from the tutorial, it works perfectly fine. However, when I code along while watching the tutorial, the flex-direction property doesn't work at all. Here's my HTML code:

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

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Blogger</title>
     <!--
         -FontAwesome Icons-->
     <link rel="stylesheet" href="css/all.css">
    <!--Custom Style-->
    <link rel="stylesheet" href="css/Style.css">
</head>
<body>
  <!---------------------Navigation------------------------>
    <nav class="nav">
        <div class="nav-menu flex-row">
            <div class="nav-brand">
                <a href="#" class="text-gray">
                  Blooger
                </a>
                <div>
                    <div class="toggle-collapse">
                        <div class="toggle-icons">
                            <i class="fas-fa-bars"></i>
                        </div>
                    </div>

                    <ul class="nav-items">
                        <li class="nav-link">
                            <a href="#">Home</a>
                        </li>
                        <li class="nav-link">
                            <a href="#">Category</a>
                        </li>
                        <li class="nav-link">
                            <a href="#">Archive</a>
                        </li>
                        <li class="nav-link">
                            <a href="#">Pages</a>
                        </li>
                        <li class="nav-link">
                            <a href="#">Contact-Us</a>
                        </li>
                    </ul>
                </div>
                <div class="social text-gray">
                    <a href="#"><i class="fab fa-facebook-f"></i></a>
                    <a href="#"><i class="fab fa-instagram"></i></a>
                    <a href="#"><i class="fab fa-twitter"></i></a>
                    <a href="#"><i class="fab fa-youtube"></i></a>
                </div>
            </div>
    </nav>
  <!-------x--------------Navigation----------x----------->


    <!--Custom javaScript-->
  <script ></script>  
</body>

</html>

css codes



@import url('../css/fonts.css');

html, body{
margin:0%;
box-sizing: border-box;
overflow-x: hidden;
}

/*Theme Colors*/
:root{

    --text-gray:#3f4954;
    --text-light:#686666da;
    --bg-color:#0f0f0f;
    --white:#ffffff;
    --midnight:#104f55;

    /* Linear Gradient Colors*/
    --sky:linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%);
}
:root{
   /* Theme Font Family */
    --Abel:'Abel', cursive;
    --Anton:'Anton', cursive;
    --Josefin:'Josefin', cursive;
    --Lexend:'Lexend', cursive;
    --Livvic:'Livvic', cursive;
}

/*----------------Global Classes---------------*/
a{
    text-decoration: none;
    color: var(--text-gray);
}

.flex-row{
    display: flex;
    flex-direction: row;    
    flex-wrap: wrap;



}

ul{

    list-style-type: none;

}

/*-------x---------Global Classes--------x-------*/

/*---------------navbar-----------------------------*/

.nav{
    background: white;
    padding: 0.2rem;
     height: 0rem;
     min-height:10vh;
     overflow:hidden;
}
.nav.nav-menu{
    justify-content:space-between;


}
.nav.nav-menu>div:last-child{
    margin:auto;
}

.nav.nav-menu::before,
.nav.nav-menu::after {
  content: '';
}

.nav .nav-items{
    display: flex;
    margin:0;
}
.nav .nav-items .nav-link{

    padding: 1.6rem 1rem ;
    font-size: 1.1rem;
    position: relative;
    font-family: var(--Abel);
    font-size: 1.6rem;
}


.nav .nav-items .nav-link:hover{
background-color: var(--midnight);

    }
    .nav .nav-items .nav-link:hover a{
        color: var(--white);
    }

.nav.nav-brand a{

    font-size: 1.6rem;
    padding: 1rem 0;
    display: block;
    font-family:var(--Lexend);
    font-size: 1.1rem;

}


.nav .social{
    padding: 1.4rem 0;
}
.nav .social i{

    padding: 0.2rem;
}

.nav .social i:hover{
color: #a1c4cf;
}

/*---x------------navbar---------x--------*/


/*----------------view-port less than or equal to 750px------------------*/
@media only screen and(max-width:750px){
    .nav .nav-menu, .nav .nav-items{
        flex-direction:column;
    }
}
/*------x----------view-port less than or equal to 750px------x------------*/

Answer №1

It seems like your content is currently hidden due to the following:

.nav{
   background: white;
   padding: 0.2rem;
   height: 0rem;
   min-height:10vh;
   overflow:hidden;
}

Your nav-bar has a height set to 0rem, causing only half of it to be displayed because of min-height: 10vh;

The issue with flex-direction not working is because there is a missing space here

@media only screen and(max-width:750px){

It should be corrected to

@media only screen and (max-width:750px){

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 Challenge of Implementing Jquery in Internet Explorer

Having troubles with Jquery in IE, the code is not working. Can anyone assist me? Please check this on IE and FF (or opera, safari, chrome), select a state, and you'll notice that clubs load but do not appear in IE while they show up in FF. Your hel ...

Prevent users from accessing the refresh and back/forward functions in all browsers

I'm currently developing an evaluation system where candidates take exams. The page displaying questions and choices is rendered within an iframe. This iframe page also includes a JavaScript timer. To prevent candidates from refreshing the page using ...

CloudFront for Amazon - Limit MP3 playback to designated website

I've been trying to find a solution for allowing mp3 files in an Amazon S3 bucket paired with Cloudfront to be streamed directly on my site without revealing the source URL of the mp3s. I want to prevent others from sharing or leeching the link by vie ...

Can the Caption Adapt to the Image?

Code snippet: <script type="text/javascript> function displayNextImage() { x = (x === images.length - 1) ? 0 : x + 1; document.getElementById("img").src = images[x]; } function displayPreviousImage() { x = ...

Struggling with finding the appropriate CSS selector?

I'm struggling to find the correct selector. Let me do my best to explain the situation: I am currently working on a project where I am unable to make changes to the HTML and JavaScript due to dynamic content and other constraints. Within this proj ...

When the window size is reduced, the image continues into the next div

I need to create a page that displays text alongside an image. However, when the window size is minimized, the image overlaps with the text. Here is how it looks: https://i.sstatic.net/CBMh8.png To fix this issue, I am using the following HTML code: ...

Extract a section of the table

I'm looking to copy an HTML table to the clipboard, but I only want to include the rows and not the header row. Here is the structure of the table: <table style="width:100%" #table> <tr> <th class="border"></th> ...

Displaying the numeric value from a MySQL database in a textbox

In my code, I utilize the following segment to populate a database table where each row contains a button with the label "Load". while($row=mysqli_fetch_array($result)) { echo" <tr id='rowNum'> <td >".$row['No.'] ...

Ways to eliminate basic text from HTML/HAML

Seeking a solution to align an image with CSS that is being hindered by unwanted text appearing next to it in Inspect Element. Despite pinpointing the source of the issue, attempts to remove the text have been unsuccessful and it continues to be a nuisance ...

Is it possible to maintain the maximum height and width of a div across all levels of zoom?

In the process of developing a web application, I encountered an issue regarding setting the width and height of a div to a fixed number, regardless of the zoom level. While I was successful in changing the background color of the div across all zoom level ...

The "placeholder" attribute effectively populates the form input in HTML, but when using Angular 2+, the "value" attribute does not fill the input field as expected

Within my Angular UI, I have implemented an edit button that allows users to transform a member's name heading into a form for editing and updating the name. The challenge lies in ensuring that the form is pre-filled with the current name. My issue a ...

Which option is more effective: using an id or using !important?

While some say to avoid using the !important rule and others argue that since ids are unique, there is no need to target like #main > #child and you can simply use #child. In my particular case: #main > div{ color: red; } #child{ color: blue;/ ...

Guide on utilizing jQuery to read and insert a local HTML file directly into a textarea

What is the best way to load a local HTML file in raw format and insert it into a textarea using jQuery version 1.3? ...

The dimension of HTML on an IOS web application

After successfully designing a web app that works well on desktop browsers and iPad Safari, I encountered an issue when trying to install it as a hybrid app using cordova 3.3.0. The problem arises with the height not displaying properly. Despite including ...

Tips for creating a table that fills the height of its parent div without surpassing it

Issue: I am facing a challenge with making a <table> element fill 100% of its container's height dynamically, without going over the limit. Context: When the height of the <table> surpasses that of the container, I want the ability to s ...

jQuery and Bootstrap collide

Here is my jQuery code that toggles visibility of different divs based on a click event: $(function () { $(".kyle-div, .tracey-div, .frank-div, .rosie-div").hide(); $("a").bind("click", function () { $(".conor-div, . ...

Tips on how to perfectly position an element in the middle of an HTML

I am struggling to get the textarea element centered using margin: 0 auto. I even attempted to place the element inside a div with margin: 0 auto style. <div style="margin: 0 auto;"> <textarea rows="4" cols"100"></textare> </div& ...

Finding the webpage URL where a form element is located

Suppose I have two pages called a.php and b.php, each with a form-tag. Both of these forms have the same action attribute set to c.php. Is there a way to determine in c.php which form (from either page a or b) triggered its submission? Using a hidden inpu ...

Modify the color of the matSnackbar

I'm having trouble changing the snackbar color in Angular using Angular Material. I tried using panelClass in the ts file and adding it to the global css, but the color remains unchanged. Any suggestions on how to resolve this? I am still new to this ...

Having trouble toggling the navbar on and off in mobile. Error message: Unable to read parentnode of undefined

When I try to make my mobile navbar full screen on a mobile device, the hamburger button works as expected when clicked. Initially, all the links are displayed in full page view, but once I click on a link, it disappears and takes me to the respective sect ...