1

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" />  
5
  • Could you explain more? Why do you want two different stylesheets? Is it just to make two different areas of the page look different? You can do that without having to resort by two different stylesheets. Commented Oct 24, 2011 at 4:54
  • yes it is. I am actually merging two webpages that were separate together. The CSS for both is fairly complex, and very different from one another, but if the two parts of the page show up as they do on the separate webpages they will look really good together Commented Oct 24, 2011 at 5:03
  • In that case you are better off doing it properly and treating it first as one set of HTML for one page, and writing the CSS for this page. I know it is more work but it will be better in the long run. Commented Oct 24, 2011 at 5:05
  • Yea thats what I am beginning to realize. This page will probably be edited and improved in the future so its probably best. Thanks for your help. Commented Oct 24, 2011 at 5:09
  • an iframe solution will work temporarily, but it is an ugly solution Commented Oct 24, 2011 at 5:11

3 Answers 3

5

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, its what I ended up doing, just was looking for an easier way
0

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

Comments

0

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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.