[PATCH 3/5] httpd_indexcgi.c: Simplify CSS
Sergey Ponomarev
stokito at gmail.com
Fri Jul 10 19:48:14 UTC 2020
Divide table to thead, tbody and tfoot as it should be in DOM.
Add row hover style.
Use short color names.
Signed-off-by: Sergey Ponomarev <stokito at gmail.com>
---
networking/httpd_indexcgi.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/networking/httpd_indexcgi.c b/networking/httpd_indexcgi.c
index a94d4983e..b652ba9ff 100644
--- a/networking/httpd_indexcgi.c
+++ b/networking/httpd_indexcgi.c
@@ -55,7 +55,6 @@ httpd_indexcgi.c -o index.cgi
"<style>" \
"table {" \
"width:100%;" \
- "background-color:#fff5ee;" \
"border-width:1px;" /* 1px 1px 1px 1px; */ \
"border-spacing:2px;" \
"border-style:solid;" /* solid solid solid solid; */ \
@@ -76,9 +75,9 @@ httpd_indexcgi.c -o index.cgi
"border-color:black;" /* black black black black; */ \
"white-space:nowrap" \
"}" \
-"tr.hdr { background-color:#eee5de }" \
-"tr:nth-child(odd) { background-color:#ffffff }" \
-"tr.foot { background-color:#eee5de }" \
+"thead, tfoot { background-color:olive }" \
+"tbody tr:nth-child(even) { background-color:beige }" \
+"tbody tr:hover { background-color:ivory }" \
"th.cnt { text-align:left }" \
"th.sz { text-align:right }" \
"th.dt { text-align:right }" \
@@ -287,7 +286,10 @@ int main(int argc, char *argv[])
"</h1>" "\n"
"<table>" "\n"
"<col class=nm><col class=sz><col class=dt>" "\n"
- "<tr class=hdr><th class=cnt>Name<th class=sz>Size<th class=dt>Last modified" "\n");
+ "<thead>"
+ "<tr><th class=cnt>Name<th class=sz>Size<th class=dt>Last modified" "\n"
+ "</thead>"
+ "<tbody>");
count_dirs = 0;
count_files = 0;
@@ -329,14 +331,17 @@ int main(int argc, char *argv[])
cdir++;
}
- fmt_str("<tr class=foot><th class=cnt>Files: ");
+ fmt_str("</tbody>"
+ "<tfoot>"
+ "<tr class=foot><th class=cnt>Files: ");
fmt_ull(count_files);
/* count_dirs - 1: we don't want to count ".." */
fmt_str(", directories: ");
fmt_ull(count_dirs - 1);
fmt_str("<th class=sz>");
fmt_ull(size_total);
- fmt_str("<th class=dt>\n");
+ fmt_str("<th class=dt>\n"
+ "</tfoot>");
/* "</table></body></html>" - why bother? */
guarantee(BUFFER_SIZE * 2); /* flush */
--
2.25.1
More information about the busybox
mailing list