Closed eurostar77 closed 3 years ago
The simplest way is to create a ContainerTag with the appropriate tag name:
new ContainerTag<>("picture");
If you will be creating a picture tag in multiple places you can create static factory methods like j2html provides (and we will add this one in the near future):
public static ContainerTag<?> picture(DomContent... dc){ return new ContainerTag<>("picture").with(dc); }
Or you can create a complete class along with the factory method(s):
public static final class PictureTag extends ContainerTag<PictureTag> {
public PictureTag() {
super("picture");
}
}
public static PictureTag picture(DomContent... dc){
return new PictureTag().with(dc);
}
...
html(
body(
picture(
source(),
img()
)
)
);
Thanks for your help!
Hi, I can not find html "picture" tag in j2html. How can I write custom tags?