user850234
user850234

Reputation: 3463

Is it possible to define different css style for a particular webpage

Is there a way to asign css style for a particular webpage. I have tried window.location.href to catch the URL of the page and defined the css but the problem is that page keeps on reloading automatically. I want to define html height as 100% for only one page because the footer for this page is not coming properly as in rest of the pages. Please suggest is it possible to define css style for only single page and if so how to do.

Upvotes: 2

Views: 151

Answers (3)

RobinS
RobinS

Reputation: 46

So this obviously depends on the application you're writing in Cake, but you can just use a different layout for each page, and include a different stylesheet?

You can just change the echo $this->Html->css('linktoyourstylesheet'); with conditions.

Upvotes: 1

sandeep
sandeep

Reputation: 92793

Give ID inside your body tag for that specific page & override your css for that specific page write like this:

HTML:

<body id="home">
     <div class="main"></div>
   </body>

CSS:

.main{color:red}

#home .main{color:yellow}

Upvotes: 0

Curtis
Curtis

Reputation: 103368

This depends on how you've structured your site.

If your site is just HTML/CSS then you can simply add a CSS file into that one page's head tag:

<head>
    <link rel="Stylesheet" href="/main.css" type="text/css" />
    <link rel="Stylesheet" href="/specificpage.css" type="text/css" />
</head>

Upvotes: 0

Related Questions