Issues arising from padding in Laravel routes

Encountering an issue with my Laravel application. It seems that when the path is only one level deep, everything appears as expected. However, if the path extends to two levels deep, the padding-top disappears.

https://i.sstatic.net/BqeiQ.jpg

https://i.sstatic.net/lF4Vz.jpg

Both of these routes lead to the same page:

Route::get('/edit', 'HomeController@edit')->name('edit');
Route::get('/profile/edit', 'HomeController@edit');

public function edit()
{
    $user = Auth::user();
    
    $tab = 'profile';
    
    return view('home.editprofile', compact('user', 'tab'));
}

The CSS I'm using includes padding-top: 60px to ensure the fixed navbar doesn't cover the MAIN element. Initially, I achieved this by placing the padding in the BODY tag.

This issue is becoming more significant because /password/reset is already getting cut off at the top. I anticipate it will become a major problem as my application expands and I need to display paths like /users/266 or similar.

I have developed another Laravel application entirely without encountering this problem.

app.blade.php

<!doctype html>
<html lang="en">
    @include('layouts.head')
  <body>
    <div id="app">
        @include('layouts.nav')

        <main>
            @yield('content')
        </main>
    </div>
    @include('layouts.footer')
    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
    <script>
        $(document).ready(function(){
            $('[data-toggle="tooltip"]').tooltip(); 
        });
    </script>
    <script>
        $('#waiverModal').on('shown.bs.modal', function () {
            $('#myInput').trigger('focus')
        })
    </script>
  </body>
</html>

...

Help?

Answer №1

<link rel="icon" href="images/logo.ico">
<link rel="stylesheet" href="css/style.css">

Since these URLs are relative, if you're in /page/home, they will attempt to access /page/css/style.css, which is not valid.

To fix this issue, you should convert these paths to absolute:

<link rel="icon" href="/images/logo.ico">
<link rel="stylesheet" href="/css/style.css">

Alternatively, it's recommended to use the url or asset helpers:

<link rel="icon" href="{{ asset('images/logo.ico') }}">
<link rel="stylesheet" href="{{ asset('css/style.css') }}">

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

Position images to the left, stacked on top of each other, with text centered on the right side of the picture

I have 5 images that I want to stack on the left side, with text displayed beside each image to the right and centered vertically. I've managed to stack the images, but the text is appearing below them instead of beside. Yes, I'm trying to creat ...

Is it recommended to apply the ARIA directory role to a breadcrumb navigation list?

Currently, I am working on enhancing the accessibility of a breadcrumbs component that is structured around a <ul> element. In my quest for solutions, I came across the concept of ARIA roles and specifically the directory role. While it seems like a ...

When the button is clicked, remove the border-bottom

Looking for help with CSS to hide the border-bottom of a button when clicked? I've attached an image for reference. Any suggestions or solutions would be greatly appreciated! View attached imageView attached image I've tried using active, focus ...

"Bootstrap 4 does not allow labels to be displayed inline with the input field

I'm currently working with Bootstrap 4 and Vue.js to populate an input form, but I'm struggling to get the label to appear inline and before the input type file. <div v-for="problem in problems"> <div class="row"& ...

The progress bar in vis.js is displaying inaccurate values

I am currently facing an issue with implementing the progress bar. The problem is that the progress bar always shows around 55% regardless of the value being set. var items = new vis.DataSet([ {id: 0, group: 0, content: 'item 0',value: 0.0, st ...

How can you eliminate the space below the items in Bootstrap pagination?

How can I remove the strange gap/space below the pagination items in Bootstrap? https://i.sstatic.net/zGhOD.png Here's the code snippet: <header role="navigation"> <!-- justify-content-end is only available on bootstrap 4 --> <n ...

"Get a glimpse of the brackets image with real-time live

I seem to be encountering a strange issue. I have double-checked the source code for my image, and when I view the page in Chrome without using Brackets, the image displays properly. However, when I use Brackets Live preview, the image does not show up i ...

Using Jinja2 to color code cells in a table based on their values

Building on this insightful inquiry: Coloring cells in a table based on the cell value using Jinja templates Is there a way to implement this specific feature for just one column of the table? For instance, focusing on the second column? ...

Looking to eliminate the extra space around elements inside the Body section

I'm diving back into HTML5 after years of coding in the old ways. Starting from scratch, I began working on a website design and code. However, I've hit a roadblock with the padding around my images that I can't seem to remove. I want all th ...

utilize javascript to style iframe from an external domain without access to its DOM structure

I have two websites, example.com and example1.com. I'm trying to display the content of example1.com within an iframe on example.com. For instance: Add this code to example.com: <iframe src='http://example1.com'> Then add the follow ...

Menu remains open and unresponsive in Bootstrap

This is an HTML site built using Bootstrap. The site has a menu that should automatically open on mouseover, but currently, it does not close automatically. (function($){ $(document).ready(function(){ $('ul.nav [data-toggle=dropd ...

Is there a way to temporarily toggle classes with jQuery?

Incorporating ZeroClipboard, I have implemented the following code to alter the text and class of my 'copy to clipboard button' by modifying the innerHTML. Upon clicking, this triggers a smooth class transition animation. client.on( "complete", ...

When the mandatory option is chosen, the scroll snap type acts similar to proximity by enforcing

My goal is to have the main hero section of the website take up the entire screen, and when the user scrolls down, they are immediately brought to the main content with the hero section no longer visible. However, I am experiencing an issue where if I do a ...

Tutorial on achieving full screen height for Bootstrap card within a column

I am working on a React grid layout with two cards, each in one column. My goal is to make the card on the left fill the entire column height (screen height), and if its content expands, have a scrollbar while keeping the second card intact and aligned to ...

Safari (mac) experiencing issues with loading material icons properly on initial attempt

Upon my initial visit to the website, I noticed that the font appeared distorted. https://i.sstatic.net/BtUxI.png However, when I right-clicked and chose "reload page", the fonts were displayed correctly. https://i.sstatic.net/3XUcA.png This issue seem ...

Issue with presenting the scrollbar alongside the Dropdown menu

I'm in the process of creating a menu with multiple items and sub-items. I'd like to have a scroll bar appear alongside the items if they become too numerous. The same goes for sub-menus and so forth. Check out this example to see what I mean. ...

Matching up irregular rows in div-made table

I have created a table using div elements that contain images as cell data. When an image is missing, I would like to center the remaining images in the row like this: With all images present: xxxxx xxxxx Missing images (2 in the second row): xxxxx xx ...

Alert Div from Bootstrap fails to appear during the second ajax request if the first ajax request is canceled

I've implemented a dismissible alert in my HTML file that starts off hidden. Here's the code snippet: <div class="alert alert-dismissible" role="alert" id="msgdiv" style="margin-bottom:5px;display: none;"> <button type="button" clas ...

Obtain the contents of the table row td element within the specified div class without relying on

I am currently working with a basic table layout, shown below: <table> <tbody> <tr> <td>img</td> <td class="mediaTitle"><span class="media_title">Media Name Title</span>< ...

Creating a fully responsive HTML page with a fullscreen image background

Seeking help from someone who can assist me. I have a challenge in creating a webpage with a background image that fills its <div>. Here is the code I used: <style type="text/css> .myclassdiv { background-image:url('IMAGEURL') ...