• Wednesday , 12 August 2020

JavaScript Tutorial For Beginners #36 – Changing CSS Styles

Code Canyon

Hey ninjas, in this JavaScript tutorial, we’ll be looking again at the setAttribute method to control in-line styling of our HTML elements, as well as utilizing the ‘style’ property that all DOM objects have access to.

If you have any questions at all, fire away :).

SUBSCRIBE TO CHANNEL – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg?sub_confirmation=1

========== JavaScript for Beginners Playlist ==========

========== CSS for Beginners Playlist ==========

========== HTML for Beginners Playlist ==========

========== The Net Ninja ============

For more front-end development tutorials & to black-belt your coding skills, head over to – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg or http://thenetninja.co.uk

========== Social Links ==========

Twitter – @TheNetNinja – https://twitter.com/thenetninjauk

Original source

3d Ocean

Related Posts


  1. Mark Balazo
    December 2, 2018 at 12:15

    Couldn't thank you enough Sir!

  2. Aaron Harris
    December 2, 2018 at 12:15

    You have made me feel so much more confident man about JavaScript, I'm pretty good at Html/Css(steady improving), have always been really afraid I couldn't understand the logic of JavaScript, thank you so much man!

  3. kaushik prasad
    December 2, 2018 at 12:15

    great 👌

  4. nuno sofyen
    December 2, 2018 at 12:15

    2:20 can we do like this : link.setAttribute ("style" , link.style + " left : 10px ; " ) ;
    so we don't have to write the old style ?

  5. Maggie Wang
    December 2, 2018 at 12:15

    thank you this is a very helpful video

  6. Marcin Sz.
    December 2, 2018 at 12:15

    4:06 pro-tip: you can use up/down arrows in console to reuse recently commands. Hope this help somebody 🙂

  7. Kamran Bhatti
    December 2, 2018 at 12:15

    how to give hover style in js
    also how to fix parentelement undefined problem

  8. Łukasz ;p
    December 2, 2018 at 12:15

    You are awesome.
    At last, I understand JS.
    Quickly and simply, this is that what i needed

  9. Thomas Gourley
    December 2, 2018 at 12:15

    Net Ninja just makes these videos as an excuse to teach us and do some development of his website at the same time XD

  10. Ayan Banerjee
    December 2, 2018 at 12:15

    For adding classes instead of replacing them, we can use

    title.className += " " + "your_class_name_here"

    The space preceding is important because js concatinates it with the previous class

  11. UTprema
    December 2, 2018 at 12:15

    Thanks for the clear short tutorials. What would be a practical use for this? Apart from changing elements in the console window?

  12. Pierre
    December 2, 2018 at 12:15

    Best net ninja teacher ever. JS so simple thanks to u. THANK YOU

  13. E Jeffery
    December 2, 2018 at 12:15

    I had been beating my head up against a rock trying to comprehend the basics of JS and your channel helps tremendously. Thank you! And lovely accent.

  14. Marinakulichok
    December 2, 2018 at 12:15

    super tutorials– THANK YOU

  15. Eric Hofer
    December 2, 2018 at 12:15

    When viewing the "text" list for style, the property is referenced as "background-color," but when setting the attribute it's camel cased without a hyphen (which is logical as attribute names cannot have hyphens as these would be minus signs). Is inconsistency here to keep the riff-raff out?

  16. Shannon Myers
    December 2, 2018 at 12:15

    For the first example, would it be the same to put "title.style.position = 'relative';" ?

  17. Wot
    December 2, 2018 at 12:15

    Thanks for this! Quick question though – if your CSS is stored in a linked .css file, will this update it there or just enter the new styles in the HTML?

Leave A Comment

You must be logged in to post a comment.