Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2017
    Posts
    2
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Using CSS from the beginning..

    Basic question.
    Do I need to include any reference to a CSS file to use CSS in my html web pages?
    I'm just starting out on this stuff.

    Do I need to download CSS and reference it to use it?

    Thanks

  2. #2
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    10,755
    Thanks
    6
    Thanked 1,282 Times in 1,252 Posts
    Yes, CSS isn’t doing anything automatically, you need a link to the CSS file before it is applied on the HTML document. It’s very simple: you have an HTML file and a CSS file both in the same directory, and your HTML file’s head section would look like this:

    Code:
    <!DOCTYPE html>
    <html>
      <head>
        <title>…</title>
        <link rel="stylesheet" href="style.css" type="text/css">
        …
      </head>
    …
    …
    This is, of course, simplified and assumes that your CSS file is called “style.css”.

  3. Users who have thanked VIPStephan for this post:

    tommydommy (01-12-2017)

  4. #3
    Regular Coder
    Join Date
    Feb 2016
    Posts
    906
    Thanks
    0
    Thanked 187 Times in 185 Posts
    I understand this question in a different way: Do I have to include a CSS file in order to use CSS like I have to include jQuery in order to use jQuery? If so, the answer is no: CSS is integrated in the browser, you can use it at once. However, if there is a large amount of CSS instructions it is common practice to place them into a custom CSS file and include it like VIPStefan explained.

  5. Users who have thanked Sempervivum for this post:

    tommydommy (01-12-2017)

  6. #4
    New to the CF scene
    Join Date
    Jan 2017
    Posts
    2
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Sempervivum View Post
    I understand this question in a different way: Do I have to include a CSS file in order to use CSS like I have to include jQuery in order to use jQuery? If so, the answer is no: CSS is integrated in the browser, you can use it at once. However, if there is a large amount of CSS instructions it is common practice to place them into a custom CSS file and include it like VIPStefan explained.
    Thank you both.. The above is what I was referring to though the first answer will definitely come in handy as I'm just starting out in this area and want to improve.

    I assumed that CSS is integrated into my browser but wasn't sure.. Thanks again.

  7. #5
    New Coder
    Join Date
    Apr 2016
    Posts
    50
    Thanks
    0
    Thanked 2 Times in 2 Posts
    You do not have to download the CSS file. You simply create a new CSS file, just like you create a new file in a project but to apply the styling of the CSS file to the project, you need to add its link in the HTML code In ASP.NET, you simply drag and drop the CSS file in the HTML code and the link is automatically created. But you can also download the CSS files of other projects but that would require a lot of editing in the CSS files. So, it is better to create a new file.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •