Hi all, Safari provides a function "Inspect element". We could get the style information from "computed Style" section. Could someone show me some code to get this "computed style"? I tried to get the style information from an element's RenderObject like this int width = render->style()->width().rawValue(); int height = render->style()->height().rawValue(); int left = render->style()->left().rawValue(); int top = render->style()->top().rawValue(); But most integers I got are zero. For example, <div id="d1" width=100> <div id="d2" > </div>
From my code, the width of d1 is 100, but the width of d2 is zero. From safari's "Inspect element"-->"computed Style", the width of d2 is 100.
How can I get the Computed Style? Thanks!
participants (1)
-
Eric Zhou