The logo appears cropped in the responsive layout

Responsive Logo Issue

I am facing an issue with the logo in the header when viewed using Chrome developer tools in the Galaxy S5 responsive view. It seems that the logo container is too big and needs to be moved after the navbar, but I am unsure how to do this.

     /* === Navigation ===*/
    
    .navbar.navbar-dark button,
    .navbar.navbar-dark button:focus,
    .navbar.navbar-dark .nav-link {
    color: #fff;
    font-size: 0.9em;
    font-weight: bold;
    }
    
    .navbar-dark {
    background-color: #2e82b0;
    
    }
    .navbar {
      min-height: 80px;
    }
    
    .navbar>.container {
    border-bottom: 1px solid #fff;
    }
    
    .navbar-brand {
      padding: 0 15px;
      height: 80px;
      line-height: 80px;
    }
    
    @media (min-width: 768px) {
      .navbar-nav > li > a {
        padding-top: 1.4em;
        padding-bottom: 1.4em;
        
      }
    }
    
    @media (min-width: 992px){
        .navbar li {
            margin-left : 1em;
            margin-right : 1em;
    font-size: 1.2em;
        }
    }
    
    
    **CSS**
    /* === Header ===*/
    
    .hero-bg {
    background-color: #2e82b0;
    }
    
    .img-logo {
    max-width: 60%;
    margin-top: 15%;
    margin-bottom: 10%;
    }
    
    
    .line {
    border-bottom: 1px solid #fff;
    }
<!DOCTYPE html>
    <html lang="de">
    
    <head>
    <!-- Important Meta Data -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    
    <!-- CSS
      ============================================================================================= -->
    
    <!-- Bootstrap -->
    <link rel="stylesheet" href="assets/css/bootstrap.min.css">
    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css?family=Montserrat|Spectral" rel="stylesheet">
    <!-- Simple Line Icons -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.css">
    <!-- Custom -->
    <link rel="stylesheet" href="assets/css/style.css">
    </head>
    
    <body>
    
    <!-- Navigation
    ============================================================================================= -->
    <header>
    <!-- Start Navigation -->
    <nav class="navbar navbar-expand-md navbar-dark fixed-top py-0">
    <div class="container">
    <button class="navbar-toggler btn-round" type="button" data-toggle="collapse" data-target="#navbar-toggle" aria-controls="navbar-toggle">
    <span class="icon-menu"></span>
    </button>
    <div class="collapse navbar-collapse justify-content-center text-uppercase font-alt" id="navbar-toggle">
    <ul class="navbar-nav">
    <li class="nav-item">
    <a href="#texting" class="nav-link">Texting</a>
    </li>
    <li class="nav-item">
    <a href="#eventkonzeption" class="nav-link">Event Konzeption</a>
    </li>
    <li class="nav-item">
    <a href="#impression" class="nav-link">Impression</a>
    </li>
    <li class="nav-item">
    <a href="#ueber" class="nav-link">Über mich</a>
    </li>
    <li class="nav-item">
    <a href="#kontakt" class="nav-link">Kontakt</a>
    </li>
    </ul>
    <!-- navbar-nav -->
    </div>
    <!-- navbar-collapse -->
    </div>
    <!-- container -->
    </nav>
    <!-- End Navigation -->
    </header>
    
    <!-- Header
    ============================================================================================= -->
    
    <!-- Header -->
    <section id="home" class="hero-bg">
    <div class="container line">
    <div class="align-items-center row justify-content-center">
    
    <div class="img-logo">
    <img class="img-fluid mb-5 d-block mx-auto img-responsive" src="resources/img/logo.png" alt="Rollywood-Logo" >
    </div>
    
    <!-- col -->
    </div>
    <!-- row -->
    </div>
    <!-- container -->
    </section>
    <!-- Header -->
    
    
    <!-- Scripts
      ============================================================================================= -->
    
    <!-- jQuery -->
    <script src="assets/js/jquery-3.2.1.min.js"></script>
    <!-- Popper -->
    <script src="assets/js/popper.min.js"></script>
    <!-- Bootstrap -->
    <script src="assets/js/bootstrap.min.js"></script>
    <!-- Custom -->
    <script src="assets/js/custom.js"></script>
    
    </body>
    
    </html>

   

Answer №1

When implementing the fixed-top class for your navbar, it is essential to adjust the top margin and/or padding of the subsequent container. It's recommended to refrain from using percentages for margin/padding in this scenario and opt for either rem units or px instead.

For a practical demonstration, you can view the working example by clicking "run code snippet" below and expanding it to full screen:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<header>
    <!-- Start Navigation -->
    <nav class="navbar navbar-expand-md navbar-light bg-light fixed-top py-0">
        <div class="container">
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-toggle" aria-controls="navbar-toggle" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>

... (remaining code snippets omitted) ...
 
</section>
<!-- Header -->

Please note: The provided code snippet does not incorporate any custom CSS but utilizes the mt-5 pt-5 classes solely for spacing purposes in this context.

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

Discovering the correct element and typing for an HTML attribute through JavaScript

We are currently working on test automation and I am looking for a way to identify the Element and Type associated with it within an html (Data-qa) attribute. For example, when looping through, the Element is identified as input and the type is radio. < ...

The PHP SDK function works flawlessly in the local host environment and in console, however, it fails to perform on the browser when deployed

My PHP function is behaving differently between the server's command line and the web page, with successful execution on a local WAMP host. Any thoughts on what could be causing this inconsistency? function getCFTemplateSummary($CFUrl){ //init client ...

Enhancing the mouse pointer in a JAVA application

Currently, I am immersed in a school project and trying to capture the attention of children by implementing a unique feature - a special mouse pointer. Imagine a pointer that moves, causing a small bird to follow its every movement. My project is based ...

Modify iframe form action URL dynamically upon user visiting the URL with a specified parameter

Below you will find a code example: The page URL is: <html> <body> <h1>main page</h1> <iframe src="http://example2.com"> <form id="test" action="http://example3.com?id=1"> ... </form&g ...

What is causing lxml to not remove section tags?

Having some trouble parsing HTML using lxml and Python. My goal is to eliminate section tags, but seems like lxml can remove other specified tags except for sections. For instance: test_html = '<section> <header> Test header </header& ...

Desktop displays do not show images, only mobile devices

My website displays multiple retailer images as affiliate links. I am facing an issue where the images are not visible on desktop for some users, even though I can see them on my end. I have tried clearing cache, cookies, and using different browsers, but ...

Add HTML and JavaScript code dynamically with JavaScript

Currently, I am working on a project that involves an HTML table with some basic JS interactions triggered by user clicks. The structure looks something like this: htmlfile.html ... ... position action ...

Disable the button when there is no input provided

How can I disable the button when the text length is less than or equal to 0 in Vue.js and set its properties within the tag? Here's the button code: <button> Add task </button> ...

Ways to resolve the issue of a website displaying with extra whitespace at the bottom

Seeking assistance to resolve the issue with a blank space at the bottom of the web page. Refer to: http://www.khohanghoa.com I have dedicated the entire day to search for a solution and attempted to fix the problem. I have attempted to configure the CS ...

Creating layered images with CSS Grid

Visit this link for more details I've been attempting to create an overlap effect with 3 photos using CSS Grid. My desired outcome looks like this: Click here to see the desired result I followed tutorials that demonstrate the same method, but unfo ...

Customizing MaterialUI styles in React: A step-by-step guide

When utilizing Material UI with React, I am facing difficulty styling the Outline Select component according to my preferences. How can I override the default styles effectively? Even after using withStyles, I am unable to achieve the desired appearance a ...

Browsing Identical Groups of Multiple Selection Drop Downs Using Javascript

Is there a way to loop through multiple form elements iteratively in order to identify the selected items from a select multiple input? I am looking for a solution that allows me to determine which selection box is being operated on and then extract all t ...

Tips for using CSS to position a sidebar on the right side of the screen:

I've been working on creating a simple sidebar and have reached this point in my code. However, I'm struggling to get it to float to the right. It's all a bit confusing for me. If you'd like to take a look at the code, here is a link t ...

How can I prevent media controls from appearing in fullscreen mode on Microsoft Edge using CSS?

My video code allows for switching the video into fullscreen mode using custom controls. Here's how it looks: fullScreenButton.addEventListener("click", function() { if (video.requestFullscreen) { video.videoContainer.r ...

Tips for achieving a standard dropdown appearance in a collapsed navbar with Bootstrap split button dropdown

Trying to create a navbar with a split dropdown button has been a challenge. The design either goes awry when the screen is narrow and the navbar is hidden behind the toggle, or it doesn't look right on a wider screen when the navbar is expanded. Cur ...

Learn how to smoothly scroll to the top of a div by clicking on a team name

CSS Code .hover-div { position:absolute; margin-top:-150px; visibility:hidden; transition:all 0.5s linear 0s; } .team_hover:hover + .hover-div { margin-top:0px; visibility:visible; } .hover-div:hover { margin-top:0px; visi ...

What steps can I take to bring my text more in line with my header?

How can I adjust the spacing between my small text and big text on my website? Here is a snippet of my HTML code: <div class="header"> <br> <br> <br> <br> <h1>Summi ...

Explaining the Usage of Nav-pills in Bootstrap v4

I am looking to align my navigation bar across the width of the div. However, I am currently using Bootstrap v4 and the nav-justify class is not available yet. Below is the code snippet: <ul class="nav nav-pills"> <li class="nav-item"> ...

What is the best way to activate an onchange function when using a <select> element?

Is there a way to automatically trigger a JavaScript function without the need for user input, while still having a default option selected? <select class="custom-select" name="" id="timer1numbers" onchange="getSelecte ...

Accessing cell values within a table using JavaScript

I am having some trouble with extracting unique IDs from the input text areas in the first column of an HTML table. These IDs are dynamically assigned using JavaScript. Can someone help me with this issue? Below is the HTML code for my table: <table id ...