Css Stylesheets and aspx

Discussion in 'ASP .Net' started by George, Aug 24, 2004.

  1. George

    George Guest


    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">
    George, Aug 24, 2004
    1. Advertisements

  2. George

    Joerg Jooss Guest

    Of course. At the end of the day ASPX just produces (X)HTML.
    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?

    Joerg Jooss, Aug 24, 2004
    1. Advertisements

  3. George

    George Guest

    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?


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

    George Guest

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

    Add the css file to the project, and then reference the
    Css class for each control, object
    George, Aug 24, 2004
  5. George

    Joerg Jooss Guest

    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.

    Joerg Jooss, Aug 24, 2004
  6. George

    George Guest

    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 :).
    George, Aug 24, 2004
    1. Advertisements

Ask a Question

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