2017-04-17 48 views
0

我在嘗試加載main.css文件的某些屬性時出現問題,從/user_create.html加載文件加載main.css就好了,但是當我嘗試從url.dev/user/create,它不加載所有的屬性,代碼從html複製/粘貼到我的blade.php文件中。Laravel不能正確加載CSS

HTML

<div class="container-fluid band-user-creation"> 
    <div class="container"> 
    <div class="row"> 
     <div class="col-lg-12"> 
      <div class="row"> 
       <div class="col-lg-4"></div> 
       <div class="col-lg-4 raleway-regular"><table > 
       <tbody>     
       ... 
       <tr> 
        <td><input name="UserName" type="name" class="input-user-creation" placeholder="Ingresa tu Nombre"></td> 
       </tr> 
       <tr> 
        <td><input name="UserLastName" type="lastname" class="input-user-creation" placeholder="Ingresa tu Apellido"></td> 
       </tr> 
       ... 

CSS

.band-user-creation{ 
padding-top: 100px; 
padding-bottom: 100px; 
color: #212121; 
text-align: center; 
} 

.input-user-creation{ 
background-color: #B2DD4C; 
font-size: x-large; 
border-radius: 10px; 
padding-left: 10px; 
border: transparent; 
color: #F9F9F9; 
margin-top: 5px; 
min-width: 300px; 
} 

enter image description here

.HTML文件頭內容

<!DOCTYPE html> 
<html lang="es"> 
<head> 
<meta charset="utf-8"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<title>...</title> 
<!-- Bootstrap --> 
<link href="css/bootstrap.css" rel="stylesheet"> 
<link href="main.css" rel="stylesheet" type="text/css"> 

<!-- Google Fonts --> 
<link href="https://fonts.googleapis.com/css?family=Raleway:300,400i,600,600i" rel="stylesheet"> 

... 

... 

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> 
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> 
<!--[if lt IE 9]> 
     <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"> 
</script> 
     <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"> 
</script> 
    <![endif]--> 
</head> 

編輯

.BLADE頭內容

<!DOCTYPE html> 
<html lang="es"> 
<head> 
<meta charset="utf-8"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<title>...</title> 
<!-- Bootstrap --> 
<link href="../../css/bootstrap.css" rel="stylesheet"> 
<link href="../../main.css" rel="stylesheet" type="text/css"> 

<!-- Google Fonts --> 
<link href="https://fonts.googleapis.com/css?family=Raleway:300,400i,600,600i" rel="stylesheet"> 

... 

... 

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> 
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> 
<!--[if lt IE 9]> 
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"> 
</script> 
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> 
<![endif]--> 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script> 
</head> 
+0

當您檢查代碼時,您是否看到.css文件?如果你看到,當你在瀏覽器上訪問該文件時會發生什麼? – AgeValed

+0

你可以在'user_create.html'文件和'.blade.php'文件中發佈你的html的''內容嗎? – stratedge

+0

@AgeValed我不是seing .band-user-creation類,也不是.input-user-creation類:/ – Schavcovsky

回答

0

你需要一個佈局刀片blank.blade.php(文件夾資源\意見\佈局)

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
     <title>Test</title> 
     <link href="{{ asset("css/style.css") }}" rel="stylesheet"> 
    </head> 
    <body 
     @yield('main_container') 
    </body> 
</html> 

,那麼你需要你的風格的.css機智所有裏面公用文件夾 的CSS然後您.blade.php

@extends('layouts.blank') 
@section('main_container') 
    <!-- ALL THE HTML --> 
@endsection 
+0

謝謝@AgeValed移動主.css做了詭計,我不太清楚爲什麼「有點」在之前工作,什麼時候它根本不應該工作。 – Schavcovsky

+0

@Schavcovsky有用的信息! :) – AgeValed

0

移動../main.css到../css/main.css做了竅門,我不明白爲什麼還有點工作之前它不應該...

+0

你的'main.css'文件在'public'文件夾中的'css'文件夾中? – stratedge

+0

@stratedge main.css現在位於css文件夾中,它位於 – Schavcovsky

+0

之前的根文件夾中。您的問題在我看來不正確**相對**引用CSS文件的位置。我會寫一個答案來解釋。 – stratedge