<< Click to Display Table of Contents >> Navigation: »No topics above this level« Styles |
There are several places where CSS styles can be defined
•inline element style = ".." attribute
•document <style> tags
•control Styles property (f.e. HtPanel.Styles)
•HtGlobal.Styles property
•HTML4Stylesheet
When calculating element style, stylesheets from above list are applied in reverse order.
1.Inline element style. F.e. <span style="font-weight:bold">. To check inline style use Element.SelfStyleSheet property.
2.Properties set by HTML4 attributes. F.e. <image width="300"> will add width:300px; to SelfStylesheet.
3.Properties set by HTML4 default stylesheet. F.e. <b> tag will cause font-weight:bold added to calculated style.
4.Properties inherited from parent elements. F.e. direction:rtl can be inherited from parent.
5.Properties calculated from document <style>..</style> section.
6.Properties calculated from Editor.Styles (or HtPanel.Styles)
To add global CSS rules use HtGlobal.Styles.Add.
To add new rules to document use Doc.Styles.Parse(NewCSS)
By default same stylesheets are cached and same styles are shared between documents.
To prevent this set THTDocument.SharedStyles to false.
To override properties set in document or element style, add new values with !important flag to control Styles property.
F.e.
a {text-decoration: underline!important}