Pain12's avatar

blade.php styling issue

Hello guys, I have a few blade files and everyone except for 2 show the right styling. So my view consists of these folders

pages: about, index
posts: create, edit, index
and 2 files outside of folders.

What I mean is that on the create and edit. blade file the navbar is not inline. See picture. Bilder-Upload.eu - share DEINE Bilder https://www.bilder-upload.eu/bild-8432b5-1579821207.jpg.html

I checked for custom style in the blade file and even removed the content except or the

@extends('layouts.app')
@section('content')
@endsection

content. But nothing changed. Does anyone have an idea why this is happening? I mean the index.blade in the folder works. Just the 2 files or broken.

0 likes
3 replies
GamerFac3's avatar

Do you have any content within the affected files, that could end a html tag? Go through the Source Code in your browser and search for differences.

1 like
Pain12's avatar

Well, I found the difference but not why this is only happening in these two files. I have 2 CSS files and somehow one overwrite the others? I don't know. Normally the style should be everywhere be the same right? If I use @extends('layouts.app') @section('content') @endsection

Cronix's avatar

I have 2 CSS files and somehow one overwrite the others?

That's how cascading style sheets work. If there are multiple definitions for the same css rule, whatever definition is loaded last will be the one used.

Let's say you had 2 different css files, and both contained a definition for body:margin-top

file1.css

body {margin-top:10px}

and file2.css

body {margin-top:20px}

If you loaded the css in this order

<link rel="stylesheet" href="/file1.css">
<link rel="stylesheet" href="/file2.css">

Then the body will have margin-top=20 because it was loaded last.

If you loaded them like

<link rel="stylesheet" href="/file2.css">
<link rel="stylesheet" href="/file1.css">

Then body martin-top = 10, for the same reason. It was loaded last. You can override some of that behavior with the !important attribute.

1 like

Please or to participate in this conversation.