SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot dbworm's Avatar
    Join Date
    Apr 2003
    Location
    Lausanne
    Posts
    115
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <style>...</style> within <body>

    In order to spice up the ads I'm publishing on this classified site, I inject my own CSS within <style>...</style> tags. To do so, I use the HTML tab provided on the Textarea of the form (like eBay). These tags are therefore within the BODY of the whole document (I obviously have no access to the <head> section of it).

    It works fine but I'm wondering if forcing <style>...</style> in the BODY itself is Ok from a technical stand point. I'm worried about disrupting the good functionning of the site.

    Thanks for any input or other ideas for doing the same thing, but please, don't suggest inline styling.

    Dan

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,603
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Since the standards say that those tags belong in the <head> it means that browsers are not required to support them in the <body>. That the current version of the major browsers do support them there does not mean that all browsers support them there or that future versions of browsers will support them. For the most part though the worst that is likely to happen is that the styles get ignored. I doubt that any browsers will just ignore the tags and display their content as text in the page.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not only that Stephen, but some mobile phones (mine especially) will just parse all styles in the BODY section, whether inlined or (incorrectly) embedded, as plain text. And I have to pay for that too! (Literally - as in money.)

  4. #4
    SitePoint Addict
    Join Date
    Apr 2006
    Posts
    249
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's always possible that some of the styles you define in your style tags may conflict with styles for the over-all site - which may make your classified look bad, or make the site-owners unhappy....


Bookmarks

Posting Permissions

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