Mark
Mark

Reputation: 75

Classes from included file NOT working

I have had this problem for a while. I am including a CSS file into an index page and the classes from the CSS file are ignored. What is wrong?

This is in CSS.php file

<!DOCTYPE HTML>

<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title>FormAssembler</title>
<script type="text/javascript" src="//code.jquery.com/jquery-2.1.4.min.js"></script>
<!-- Icon -->
<link rel="icon" href="https://student.sps-prosek.cz/~moudrmi14/Navrhy/Projekt/barchart-icon.png" type="image/gif" sizes="16x16">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

<style type="text/css">

    .center{
        -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.75);
        -moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.75);
        box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.75);
    }

    body {background: linear-gradient(white,rgba(77, 184, 255, 0.34);}

    .alignCenter {text-align: center;}
    .margin0 {margin: 0 auto;}


     /* INDEX */
    .CCSnavbar-class {position: relative;top: 5px;width: 1300px;margin: 0 auto;}
    .header {width: 1200px;margin: 0 auto;}
    .line {background-color: rgb(146, 145, 145);width: 100%;height: 1px;margin-bottom: 15px;}
    .content {width: 1200px;margin: 0 auto;}




</style>

        <!-- Navbar -->
        <ul class="nav navbar-nav">
            <li><a href="https://student.sps-prosek.cz/~moudrmi14/Navrhy/Projekt/" title="Home">HOME</a></li>
            <li><a href="https://student.sps-prosek.cz/~moudrmi14/Navrhy/Projekt/slavek_veci/form_assemble.php">FORM ASSEMBLE</a></li>
            <li><a href="">PROFILE</a></li>
        </ul>

        <!-- Navbar log/reg -->
        <ul class="nav navbar-nav navbar-right">
            <li><a href="https://student.sps-prosek.cz/~moudrmi14/Navrhy/Projekt/slavek_veci/registration.php"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
            <li><button class="btn btn-link" data-toggle="modal" data-target="#myModal" style="margin-top: 8px;"><span class="glyphicon glyphicon-log-in"></span>    Login</button></li>
        </ul>

    </div>
</nav>

<div class="center" style="margin: 0 auto; width: 1300px;background-color: white;">

        <div class="filler1" style="width: 100%; height: 10px;background-color: white;margin-top: 20px;">
        </div>

This is a part of the Index page

<?php include "CSS.php"; ?>

        <!-- Header -->
        <div class="header">
            <H1>Welcome to FormAssembler</H1>
            <div class="line">
            </div>
        </div>

        <div class="content">

Header, Content, body doesn't work either. The whole CSS is beeing ignored

Upvotes: 0

Views: 66

Answers (3)

iyyappan
iyyappan

Reputation: 777

You made mistake in CSS file.Please make syntax on CSS properties.

Inbetween the body tag syntax error,Try below the codes.

<style type="text/css">

    .center{
        -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.75);
        -moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.75);
        box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.75);
    }

    body {background: rgba(77, 184, 255, 0.34);}

    .alignCenter {text-align: center;}
    .margin0 {margin: 0 auto;}


     /* INDEX */
    .CCSnavbar-class {position: relative;top: 5px;width: 1300px;margin: 0 auto;}
    .header {width: 1200px;margin: 0 auto;}
    .line {background-color: rgb(146, 145, 145);width: 100%;height: 1px;margin-bottom: 15px;}
    .content {width: 1200px;margin: 0 auto;}




</style>

Upvotes: 1

Yair Mishnayot
Yair Mishnayot

Reputation: 74

a. don't put the style tag on your css file, you don't need it if you'r write the code in the css file itself.

b. I order to link the css file to the html file I would simply use:

<link rel ="stylesheet" href = "path_to_css_fill">

put that on the head part of the your html page

Upvotes: 0

Anubhav pun
Anubhav pun

Reputation: 1323

try to use this as CSS file put in style.css and then include in as

 <?php include "style.css"; ?>

for correct including css in index file

Upvotes: 0

Related Questions