Class Style


@Bean(typeName="style") public class Style extends HtmlElementRawText
DTO for an HTML <style> element.

The style element allows authors to embed CSS style information in their documents. It contains CSS rules that apply to the document. The style element is typically placed in the head section of the document, but can also be used inline. The CSS contained within the style element is processed by the browser and applied to the document.

Examples:

import static org.apache.juneau.bean.html5.HtmlBuilder.*; // Basic CSS styles Style basic = style() .text("body { font-family: Arial, sans-serif; }"); // CSS with media query Style responsive = style() .media("screen and (max-width: 600px)") .text("body { font-size: 14px; }"); // Multiple CSS rules Style multiple = style() .text( "h1 { color: blue; }", "p { margin: 10px; }", ".highlight { background-color: yellow; }" ); // CSS with type specification Style typed = style() .type("text/css") .text(".button { padding: 10px; background: #007bff; }"); // Print-specific styles Style print = style() .media("print") .text("body { color: black; background: white; }");

The following convenience methods are provided for constructing instances of this bean:

See Also: