diff --git a/html/element.go b/html/element.go
index d89d7fd..e1c6b89 100644
--- a/html/element.go
+++ b/html/element.go
@@ -27,6 +27,10 @@ func (e *Element) Href(href string) *Element {
return e.Attribute("href", href)
}
+func (e *Element) Name(name string) *Element {
+ return e.Attribute("name", name)
+}
+
func (e *Element) Src(src string) *Element {
return e.Attribute("src", src)
}
diff --git a/html/html.go b/html/html.go
index 6e1ea7c..aa61902 100644
--- a/html/html.go
+++ b/html/html.go
@@ -15,21 +15,27 @@ type HTMLer interface {
func Background() *Element { return NewElement("") }
+func NewHTML() *Element { return NewElement("html") }
+
func A() *Element { return NewElement("a") }
func B() *Element { return NewElement("b") }
+func Body() *Element { return NewElement("body") }
func Br() *Element { return NewElement("br") }
func Div() *Element { return NewElement("div") }
func Em() *Element { return NewElement("em") }
func Form() *Element { return NewElement("form") }
func H1() *Element { return NewElement("h1") }
func H2() *Element { return NewElement("h2") }
+func Head() *Element { return NewElement("head") }
func I() *Element { return NewElement("i") }
func Img() *Element { return NewElement("img") }
func Input() *Element { return NewElement("input") }
func Label() *Element { return NewElement("label") }
func Li() *Element { return NewElement("li") }
+func Meta() *Element { return NewElement("meta") }
func P() *Element { return NewElement("p") }
func Span() *Element { return NewElement("span") }
+func Style() *Element { return NewElement("style") }
func Svg() *Element { return NewElement("svg") }
func Table() *Element { return NewElement("table") }
func Tbody() *Element { return NewElement("tbody") }
diff --git a/html/table.go b/html/table.go
index 4e6c1af..36a579f 100644
--- a/html/table.go
+++ b/html/table.go
@@ -2,7 +2,11 @@ package html
import "strconv"
-func Tr[T *TableHeader | *TableData](element ...T) *Element {
+var _ HTMLer = new(TableCell)
+
+type TableCell struct{ *Element }
+
+func Tr(element ...*TableCell) *Element {
tr := NewElement("tr")
for _, i := range element {
tr.AppendContent(i)
@@ -10,60 +14,45 @@ func Tr[T *TableHeader | *TableData](element ...T) *Element {
return tr
}
-var (
- _ HTMLer = new(TableHeader)
- _ HTMLer = new(TableData)
-)
-
-type (
- TableHeader struct{ *Element }
- TableData struct{ *Element }
-)
-
-func Th(content any) *TableHeader {
- return &TableHeader{NewElement("th").Content(content)}
-}
-
-func (th *TableHeader) Abbr(abbr string) *TableHeader {
- th.Element.Attribute("abbr", abbr)
- return th
+func Th(content any) *TableCell {
+ return &TableCell{NewElement("th").Content(content)}
}
-func (th *TableHeader) Colspan(n uint) *TableHeader {
- th.Element.Attribute("colspan", strconv.FormatUint(uint64(n), 10))
- return th
+func Td(content any) *TableCell {
+ return &TableCell{NewElement("td").Content(content)}
}
-func (th *TableHeader) Headers(headers string) *TableHeader {
- th.Element.Attribute("headers", headers)
- return th
+func (cell *TableCell) Abbr(abbr string) *TableCell {
+ cell.Element.Attribute("abbr", abbr)
+ return cell
}
-func (th *TableHeader) Rowspan(n uint) *TableHeader {
- th.Element.Attribute("rowspan", strconv.FormatUint(uint64(n), 10))
- return th
+func (cell *TableCell) Colspan(n uint) *TableCell {
+ cell.Element.Attribute("colspan", strconv.FormatUint(uint64(n), 10))
+ return cell
}
-func (th *TableHeader) Scope(scope string) *TableHeader {
- th.Element.Attribute("scope", scope)
- return th
+func (cell *TableCell) Headers(headers string) *TableCell {
+ cell.Element.Attribute("headers", headers)
+ return cell
}
-func Td(content any) *TableData {
- return &TableData{NewElement("td").Content(content)}
+func (cell *TableCell) Rowspan(n uint) *TableCell {
+ cell.Element.Attribute("rowspan", strconv.FormatUint(uint64(n), 10))
+ return cell
}
-func (td *TableData) Colspan(n uint) *TableData {
- td.Element.Attribute("colspan", strconv.FormatUint(uint64(n), 10))
- return td
+func (cell *TableCell) Scope(scope string) *TableCell {
+ cell.Element.Attribute("scope", scope)
+ return cell
}
-func (td *TableData) Headers(headers string) *TableData {
- td.Element.Attribute("headers", headers)
- return td
+func (cell *TableCell) Class(class ...string) *TableCell {
+ cell.Element.Class(class...)
+ return cell
}
-func (td *TableData) Rowspan(n uint) *TableData {
- td.Element.Attribute("rowspan", strconv.FormatUint(uint64(n), 10))
- return td
+func (cell *TableCell) Style(style string) *TableCell {
+ cell.Element.Style(style)
+ return cell
}