Css Stylesheets and aspx

G

George

greetings,

just checking if it is appropriate practice to use css
stylesheets with aspx. If not, what is the recommended
way to format aspx pages? If css is ok do you call the
css same as html?

<link rel="stylesheet" type="text/css" href="MyStyles.css">
 
J

Joerg Jooss

George said:
greetings,

just checking if it is appropriate practice to use css
stylesheets with aspx.

Of course. At the end of the day ASPX just produces (X)HTML.
If not, what is the recommended
way to format aspx pages? If css is ok do you call the
css same as html?

<link rel="stylesheet" type="text/css" href="MyStyles.css">

Sure. But why should each ASPX or HTML file have its own style sheet? Isn't
it more viable to have common styles shared by many web forms or pages?

Cheers,
 
G

George

Thanks for the reply. Actually, I was planning on having
just one css file with all the styles shared by all the
pages. Just asking, but isn't that how you share common
attributes? If it isn't I'm still in the learning phase
and open to any suggestions. I would like to get in the
correct habits early on.

I noticed in visual studio (2003) that there is the
default styles.css file located in the solution explorer
window. If I were to place MyStyles.css in the same
window (add to the project) would that make accessible to
all the pages such that I wouldn't need this line?

<link rel="stylesheet" type="text/css" href="MyStyles.css">

If so, how would each page know to use MyStyles.css - how
to reference MyStyles.css from the Solution Explorer?
 
G

George

Well, here is what I will try, unless someone suggests
otherwise:

Add the css file to the project, and then reference the
Css class for each control, object
 
J

Joerg Jooss

George said:
Thanks for the reply. Actually, I was planning on having
just one css file with all the styles shared by all the
pages. Just asking, but isn't that how you share common
attributes? If it isn't I'm still in the learning phase
and open to any suggestions. I would like to get in the
correct habits early on.

I noticed in visual studio (2003) that there is the
default styles.css file located in the solution explorer
window. If I were to place MyStyles.css in the same
window (add to the project) would that make accessible to
all the pages such that I wouldn't need this line?

<link rel="stylesheet" type="text/css" href="MyStyles.css">

If so, how would each page know to use MyStyles.css - how
to reference MyStyles.css from the Solution Explorer?

Just because some file is in project doesn't mean it's accessible at run
time. You have to have a <link /> tag for each of your CSS files.

Cheers,
 
G

George

Thanks. That did the trick! I created an extern .css
file and added the <link> tag to the <head> tag, and now I
have all these great attributes to play with :).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top