vikaskimt
vikaskimt

Reputation: 21

Laravel 4 css & javascript link using {{ HTML}}

I am beginner in Laravel 4 and I have include css file using HTML class but it's not working so please help me. My code is :-

In view :- model_window.php

<?php HTML::style('css/style.css'); ?>

<a href="#openModal"><input  type="submit" value="show" name=""show_button></a>

<div id="openModal" class="modalDialog">
   <div>
      <a href="#close" title="Close" class="close">X</a>
      <h2>Modal Box</h2>

   </div>
</div>

my css file :- in public -> css -> style.css

.modalDialog:target {
                  opacity:1;
                  pointer-events: auto;
                   }

     .modalDialog > div {
                width: 400px;
                position: relative;
                margin: 10% auto;
                padding: 5px 20px 13px 20px;
                border-radius: 10px;
                background: #fff;
                background: -moz-linear-gradient(#fff, #999);
                background: -webkit-linear-gradient(#fff, #999);
                background: -o-linear-gradient(#fff, #999);
                 }

Upvotes: 2

Views: 12802

Answers (4)

DolDurma
DolDurma

Reputation: 17311

you can rename your file to such as index.blade.php second of that must be have blade and you can simply use:

    {{ HTML::style('public/css/index.css') }}
    {{ HTML::script('public/js/jquery.pnotify.min.js') }}

Upvotes: 6

DolDurma
DolDurma

Reputation: 17311

you must to put files into public directory and then can easily use

<?php echo HTML::style('css/style.css'); ?>

Upvotes: 5

Andreyco
Andreyco

Reputation: 22872

Your view is invalid. You need to include link to .css file between tags.

<!doctype html>
<html lang="en">
<head>
    <?=HTML::style('link/to/style.css')?>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
    <a href="#openModal"><input  type="submit" value="show" name=""show_button></a>

    <div id="openModal" class="modalDialog">
       <div>
          <a href="#close" title="Close" class="close">X</a>
          <h2>Modal Box</h2>

       </div>
    </div>
</body>
</html>

Now, it will work.

Upvotes: 3

ciruvan
ciruvan

Reputation: 5213

You always have to include your CSS files in the <head> section of your HTML. That's why your styles aren't applied.

And the relevant line should be:

<?php echo HTML::style('css/style.css'); ?>

Upvotes: 3

Related Questions