【发布时间】:2017-02-07 22:15:34
【问题描述】:
我正在开发一个网站,必须完成候选人输入和记录搜索。
我创建了一个 Blade 视图文件。其中有根据if条件调用的不同部分。
我的 Display.blade.php 视图如下
<center>
@if($ID>0)
<table border="0" width="100%">
<tr>
<td>@include('Header')</td>
</tr>
<tr>
<td style="font-family:arial;font-size:30px;text-align:center;">Edit Registration</td>
</tr>
</table>
@endif
<!--First Call-->
@if($ID < 0)
<table border="0" width="100%">
<tr>
<td>@include('Header')</td>
</tr>
<tr>
<td style="font-family:arial;font-size:30px;text-align:center;">New Registration1</td>
</tr>
</table>
<form action="/Register" method="post" target="_self">
<input type = "hidden" name = "_token" value = "<?php echo csrf_token() ?>">
<table border="1" width="70%" cellpadding="3" style="border-collapse: collapse" bordercolor="#eeeeee">
<tr>
<td>First Name</br><input type="text" name="fname" /></td>
<td>Middle Name</br><input type="text" name="mname" /></td>
<td>Last Name</br><input type="text" name="lname" /></td>
<td>Contact No</br><input type="text" name="contactno" /></td>
</tr>
<tr>
<td colspan="4" align="center"><input type="submit" value="Submit"></td>
</tr>
</table>
</form>
@endif
</center>
Header.blade.php 如下。
<style>
.container
{
background-image: url("header.jpg");
background-repeat: repeat-all;
left:0;
top:0;
width:100%;
height:80px;
}
</style>
<div class="container">
<div class="Cname">Cube Placement</div>
<div class="rTable">
<div class="rTableRow">
<div class="rTableHead">
<strong>
<a href='{!!url('/Register'); !!}'>Register</a>
</strong></div>
<div class="rTableHead"><strong>Report</strong></div>
</div>
</div>
</div>
代码执行良好。执行编辑注册部分时,页面中缺少 CSS,但当调用新注册部分时,CSS 工作正常。 除了一切正常。
我的代码有什么问题。
【问题讨论】:
-
如何在刀片文件中包含 css?
-
我在 display.blade 和 header.blade 的样式部分都包含了 CSS。就像在一个 if 条件 css 样式确实出现但不在另一个中一样
-
您说页面中缺少 css。那么“如何”将其插入两个文件中?根据您插入资产的方式,它可能会或可能无法从特定位置访问
-
我可能解释不正确,对此我深表歉意。我通过 css 在 Header.blade.php 文件中包含了一个 header.jpg 图像。但是header.jpg文件不包含在编辑注册中
-
你能在你添加css的地方添加代码吗?