[−][src]Function div::new_styled
pub fn new_styled<'a, C, CSS, S1, S2, S3>(
x: u32,
y: u32,
w: u32,
h: u32,
html: &str,
classes: C,
css: CSS
) -> Result<DivHandle, DivError> where
C: IntoIterator<Item = &'a S1>,
CSS: IntoIterator<Item = &'a (S2, S3)>,
S1: AsRef<str> + 'a,
S2: AsRef<str> + 'a,
S3: AsRef<str> + 'a,
Creates a new div at the defined position with the given HTML as content and with CSS classes and inline styles.
Traditionally on the web, classes in combination with a style-sheet are the best way to apply CSS to HTML. But sometimes, it can also be useful to add styles right on the top HTML element of a div. With this function, both options are open and can even be combined.
This function has several generic parameters to maximize flexibility and allow for all combinations of &str and String. When using empty iterators, sometimes the compiler gets irritated. Use explicit type to help it.
Example
let html = "Some text"; let classes = ["my-class"]; let css: [(&str, &str);0] = []; let div = div::new_styled( 0,0,1000,1000, html, &classes, &css, ).unwrap();