Christopher H
Christopher H

Reputation: 2194

Multiple HTML links to CSS

I am working with a django setup HTML and I want the first part of my html page to be determine by the first CSS stylesheet. The rest I want to be controlled by a different one. Is this possible. I put an HTML CSS link (below) above the code I want it to control. It doesn't seem to work and it looks like it gets applied to all the HTML. Is there a way to specify the CSS link to just the code I want.

<link href="folder/to/css/style.css" rel="stylesheet" type="text/css" />  

Upvotes: 1

Views: 149

Answers (3)

Russell
Russell

Reputation: 17737

You could use a specific section class, and link to both css stylesheets, for example:

<!-- Represents a first CSS file. -->
<style>
.section1.customclass
{
  background-color: red;
}

</style>

<!-- Represents a second CSS file. -->
<style>
.section2.customclass
{
  background-color: blue;
}
</style>

<div class="section1">

  <input type="text" class="customclass" />

</div>

<div class="section2">
  <input type="text" class="customclass" />
</div>

Upvotes: 0

Jorge Zapata
Jorge Zapata

Reputation: 2336

Why don't you use different classes for the elements below? Also make sure you understand CSS specifity

Upvotes: 5

Moin Zaman
Moin Zaman

Reputation: 25465

No, you can't do that. You could use an iframe that has its own CSS.

Upvotes: 0

Related Questions