Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9312465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:38:14+00:00 2026-06-19T01:38:14+00:00

If CSS Stylesheets are defined inline with <style> , then why are they referenced

  • 0

If CSS Stylesheets are defined inline with <style>, then why are they referenced with <link>?

JavaScript uses the <script> tag to define inline scripts and references them with <script src="">, so why not use <style src=""> for CSS? Is there a special function that the <link> tag can preform that using <style> can’t?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T01:38:15+00:00Added an answer on June 19, 2026 at 1:38 am

    The root of this asymmetry between style and source comes from the differences in how HTML handles scripts and resources. Javascript is (surprise!) a script, while stylesheets are considered a resource.

    As we know, scripts can be both written inline or sourced out from other pages, both with that same element: script. This is how the specs tells us it should work.

    But also per the spec, the style element defines styling to your page, and that’s all it can do. It can’t reference styling from any other documents like the script tag can. Why? I can’t say more.

    A link element, on the other hand, links resources to your page, which can be stylesheets and other things, too. So when you’re outsourcing style, you don’t use <style> but instead you <link> it.

    It’s true that one could imagine being able to write something like <style src=''> where you set the source of your styling, but, alas, that attribute doesn’t exist. So we can’t!

    Now I understand that saying “Because the specs say so” might be the most satisfying answer. But it’s the best I can do for ya right now.

    Source: the specs for styles and links.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a CSS file in vendor/assets/stylesheets, and I'd like to link to it
I was observing my HTTP headers for css files and noticed both stylesheets <link
I have stylesheet block in base layout: {% stylesheets filter='cssrewrite' 'bundles/static/css/main.css' %} <link rel=stylesheet
HTML: <!DOCTYPE HTML> <html> <head> <meta charset=UTF-8> <title></title> <link href=style.css rel=stylesheet type=text/css> <script src=http://code.jquery.com/jquery-1.6.4.min.js></script>
I have .js Javascript file, inside which I reference CSS classes defined in a
My website has a stylesheet defined in the header as style.css with a selector:
In _Layout.cshtml I have the following defined in the tag: @RenderSection(JavaScript, required: false); The
I typically use CSS classes defined in stylesheets for styles that I re-use often,
I have a CSS class defined, call it: <style type=text/css> .Foo { position: fixed;
I have a CSS stylesheet defined in the Master Page of my project. On

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.