driodev driodev - 5 months ago 22
CSS Question

Edit CSS using Dart

Can I edit a HTML-tag's CSS using DART?

I have done some searching but I couldn't really find out how to do it, or if it even is possible.

The reason to do this because I would like to change a button's location on a page.

Answer

You can change or view css properties through Element.style. The Element.style is an instance of CssStyleDeclaration. You can do the following:

Element element = document.querySelector("div")
  ..style // edit any of the properties of this variable
  ..style.background = "orange";
Comments