droidev
droidev

Reputation: 7380

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.

Upvotes: 2

Views: 1602

Answers (3)

john yendt
john yendt

Reputation: 1

You may want to look at the dart class CssStyleSheet which can grab a sheet and delete, insert and add rules. You need to know the index of the rule in the style sheet.

Upvotes: 0

0xcaff
0xcaff

Reputation: 13681

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";

Upvotes: 4

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657058

I guess you are looking for something like

var el = document.querySelector('.somediv'); 
// or '#someid' or other CSS selector to get hold of an element
el.style.color = 'blue';

Upvotes: 1

Related Questions