Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other HTML color change [creates a border]

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #241328
    danugi.4u
    Participant

    There is a way to style the HTML tag itself.

    They have this at

    http://jsfiddle.net/aEHdw/

    Remove the 3 lines in the html element

    Put any color inside the single quotes below and run it…
    document.html.style.background = ”;

    …and it works.

    Now, when I use this code in my own html page, it doesn’t work. But it works on fiddle

    (How did I get this to work in my own page?)

    Another way is to attach a CSS to the element to a JavaScript and use:

    function swapStyleSheet(sheet) onclick=".getElementById('pagestyle').setAttribute('href',sheet)">

    The latter works; but I would have to add a different CSS for each color.

    The thing is about styling the HTML tag, is it creates a border; I saw this on another site; and the page looks so freaking cool!

    What else can be done to do this? I’d like to save space by not attaching a separate page for every element. I’m looking at something to do with onclick.

    I have used inline JS for my other options (
    page color used:

    onclick="document.body.style.backgroundColor='*'"

    , font color used

    onclick="document.body.style.color='*'"

    , and font size used:

    onclick="document.body.style.fontSize='*'"

    ) and each has worked.

    #241336
    Beverleyh
    Participant

    Hmmm this all seems rather deja vu-y.

    Are you @LIP_lostinprogramming per chance?

    It’s just that your conversation style (wandering off the OP’s original topic like this https://css-tricks.com/forums/topic/website-in-an-hour-challange/#post-241335), timing (when the other account stops posting and a new account springs up), topic choices (character sets, colour backgrounds, style switches, building an information website) and the fact that you’re referring to a JS function name “swapStyleSheet” that we’ve already seen used in the http://honestlee.info website, all points to you being the same person.

    It’s probably better to use one account in future. Disagreements with moderators happen but hiding behind an alias afterwards seems less honest than working through it.

    #241337
    danugi.4u
    Participant

    That’s where I got my idea from

    #241347
    Paulie_D
    Member

    There is a way to style the HTML tag itself.

    Of course…it’s called CSS.

    It’s an element like any other.

    Look

    http://codepen.io/Paulie-D/pen/XdqXZv

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Other’ is closed to new topics and replies.