Search code examples
asp.netcssstylesheetinline

Inline styles vs styles in CSS


I know placing all your styles in a CSS file is the best thing to do as it is a lot neater.

But does it REALLY matter if the styles are inline or in a CSS?????

Edit below

My plan is to just place the styles in my MasterPage and all other pages will use the MasterPage....I believe the correct term is not "INLINE" but Embedded???


Solution

  • Using Inline CSS:

    • Repeat the same rule for every element in the page.
    • More code and bigger file size to transfer to the client.
    • Harder to maintain, suppose you want to change the width to 200px, you will need to go through all the page and edit one by one.

    inline:

    <div style="width:100px; height:100px;"></div>
    <div style="width:100px; height:100px;"></div>
    

    external OR put css classes in the head [embedded styling]:

    <div class="big"></div>
    <div class="big"></div>
    

    Based on your edit: that seems not to be inline CSS as in my example above, it is the same idea as using an external file, so if you want to do that go ahead, it is the same.