Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS in ASCX pages

Status
Not open for further replies.

CorbinMyMan

Technical User
Feb 4, 2005
267
US
Quick question:

If i have a css stylesheet linked in my .ascx page and I'm wondering will that stylesheet be recognized by any pages the ascx page is included in, and visa versa??

Thanks!
 
It should work. CSS should be processed after your file is already included so there should be no difference.

However, are you aware that you can only link stylesheets in the head part of the html document?
 
What's a header? There's head in html, there's heading. I know of no header.
 
sorry:
when i say header i meant my ascx page that can be included on any other page.

 
Well, you can do this.
Code:
<html>
  <head>
   include header.ascx
  </head>
...
What you cannot do is this:
Code:
<table>
  <tr> 
    <td>my cell one</td>
    <td> inclucde header.ascx </td>
...
If in this case header.ascx includes only link to the stylesheet. But since you're so unwilling to tell us anything, it is hard to be of much help.
 
How have I been unwilling to tell you anything???

I asked you a question, and gave me a reply. You haven't asked for any information other than what I meant when I said 'header' and I explained...
 
I answered your initial question. After that, all the more you asked was 'so i cannot link a stylesheet in my header?'. Sorry, but this question on its own means nothing. If you would back up everything with some code, we might be able to understand it, but as is, we're just wandering in the dark.

1. How are you linking the stylesheet?
2. What is in this 'header', your ascx page?
3. Where would you include it?
4. Why would you include a file that includes a stylesheet?
 
1. I'm linking the stylesheet using
<link rel="stylesheet" type="text/css" href="stylesheet.css">

2. The 'header' was what I was using to describe my ascx page, since it will be at the top of each page I choose to include it on. I apologize if it wasn't proper terminoligy, thats just what I've always referred to it as.

3. If you're asking where I would include my ascx file, I plan on including it on the top of select aspx pages I've built.

4. This is pretty much the basis of me creating this post. Let me explain: I'm wondering do I link the style sheet (as described in #1) in my ascx page? Is it even necessary to do so? The aspx page that the ascx page is included on will have a linked stylesheet, and I'm wondering if that will take precedence over the style of the ascx page.


I hope this clears up some of your questions. Thanks for your patience.
 
Since stylesheet will be loaded when the client requests the page and includes will be done on the server, the include plays no part in it. Precedence will be taken by the stylesheet that is loaded later (on a lower line). If you link the stylesheet in aspx first and then include ascx file, stylesheet from ascx will take precedence. And vice versa.
 
So it sounds like to me I should link my ascx first, and then my stylesheet (which includes my style for the ascx).

Is this correct? Thanks for the detailed explanation!
 
That sounds about right, yes. As I said, I could offer more if I had more information to go on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top