Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    1
    Member #
    28220
    Hey guys. Looking for a new forum home :wavespin:

    Right now I have ridiculously large html and css on one page. My css is reaching about 2000 lines since one page has about 8 modes. I'm creating a new page right now that will probably have 12 modes. I was wondering whether you could embed a css script tag into an html body tag.

    Code:
    <body>
     <div class="holder">
      <script type="text/css">
         #replyMsg { background-color: #DDD; }
      </script>
      <div id="replyMsg">
         reply
       </div>
     </div>
    
    </body>
    EDIT: I'm not interested in switching to a stylesheet everytime I want to make a change. I just want to be able to quickly edit script on the same page.

  2.  

  3. #2
    WDF Staff George Dolidze's Avatar
    Join Date
    Apr 2011
    Location
    Irvine, CA
    Posts
    2,487
    Member #
    27540
    Liked
    416 times
    What's the point of putting in a div though? You definitely should use external style sheets. You can even make a sheet for each div if you really feel like it! Switching betwixt two pages isn't too hard.
    I don't think you can put the CSS in <body>, unless it's inline, like <div style="border: 2px"> for example.
    My freelancer website: DolidzeDesign



    You only need a parachute if you plan on skydiving twice.

  4. #3
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    You could... And some browsers may actually render it.. But it won't validate... And not sure which browsers It would work on.. Inline styling is your next option...

    But with server scripting languages... You could just throw a variable for each "mode"' and write whatever CSS you want as the page is being loaded... decreasing your load time..

    The benefit of using an external file is to reduce load time... Once the CSS file is in a pc's memory.. If you request another page that references the external CSS sheet again... The server will respond to the head request that the file has not changed since the last request... And the pc will pull the file from memory instead... Loading much faster...

    As a designer your main concern should be the visitors experince on the site.. Not something because it's convient for you...

    Don't think I've Ever heard a developer say... Let em wait... It's easier for me that way.. They might be thinking it... But never heard someone actually say it out loud.

  5. #4
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,485
    Member #
    425
    Liked
    2783 times
    Here's how I handle the situation...I have two CSS files. One CSS file contains the common styles I need for all pages (or at least a large percentage of pages) regardless of what page the user is on.

    The second CSS file contains the styles for that specific page only. This way, should the page be rerequested (e.g. a user coming back to the home page), the user can do as Webzarus suggested and retrieve the CSS file from cache.

    This way, I can split up common design elements and page-specific elements and it makes my CSS that much easier to read.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  6. #5
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    I really got to quit posting from my phone... Can't proofread very good from it.


Remove Ads

Posting Permissions

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

Search tags for this page

script within css

Click on a term to search for related topics.
All times are GMT -6. The time now is 04:47 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com