Default.css 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. /* Default user-agent stylesheet for LibWeb
  2. * Note: This stylesheet starts with a bunch of ad-hoc custom rules.
  3. * After that, rules from the HTML spec follow.
  4. */
  5. html {
  6. font-family: sans-serif;
  7. color: -libweb-palette-base-text;
  8. }
  9. body {
  10. margin: 8px;
  11. }
  12. center {
  13. text-align: -libweb-center;
  14. }
  15. blink {
  16. display: inline;
  17. }
  18. /* FIXME: This doesn't seem right. */
  19. label {
  20. display: inline-block;
  21. }
  22. /* FIXME: This is a temporary hack until we can render a native-looking frame for these. */
  23. input, textarea {
  24. border: 1px solid -libweb-palette-threed-shadow1;
  25. min-width: 80px;
  26. min-height: 16px;
  27. width: 120px;
  28. cursor: text;
  29. overflow: hidden;
  30. }
  31. textarea {
  32. padding: 2px;
  33. display: inline-block;
  34. overflow: scroll;
  35. }
  36. input[type=submit], input[type=button], input[type=reset], input[type=checkbox], input[type=radio] {
  37. border: none;
  38. min-width: unset;
  39. min-height: unset;
  40. width: unset;
  41. cursor: unset;
  42. }
  43. button, input[type=submit], input[type=button], input[type=reset] {
  44. padding: 1px 4px;
  45. background-color: -libweb-palette-button;
  46. border: 1px solid -libweb-palette-threed-shadow1;
  47. color: -libweb-palette-button-text;
  48. }
  49. button:hover, input[type=submit]:hover, input[type=button]:hover, input[type=reset]:hover {
  50. background-color: -libweb-palette-hover-highlight;
  51. }
  52. option {
  53. display: none;
  54. }
  55. /* 15.3.1 Hidden elements
  56. * https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements
  57. */
  58. area, base, basefont, datalist, head, link, meta, noembed,
  59. noframes, param, rp, script, style, template, title {
  60. display: none;
  61. }
  62. [hidden]:not([hidden=until-found i]) {
  63. display: none;
  64. }
  65. [hidden=until-found i]:not(embed) {
  66. content-visibility: hidden;
  67. }
  68. embed[hidden] {
  69. display: inline;
  70. height: 0;
  71. width: 0;
  72. }
  73. input[type=hidden i] {
  74. display: none !important;
  75. }
  76. @media (scripting) {
  77. noscript {
  78. display: none !important;
  79. }
  80. }
  81. /* 15.3.2 The page
  82. * https://html.spec.whatwg.org/multipage/rendering.html#the-page
  83. */
  84. html, body {
  85. display: block;
  86. }
  87. /* 15.3.3 Flow content
  88. * https://html.spec.whatwg.org/multipage/rendering.html#flow-content-3
  89. */
  90. address, blockquote, center, dialog, div, figure, figcaption, footer, form,
  91. header, hr, legend, listing, main, p, plaintext, pre, xmp {
  92. display: block;
  93. }
  94. blockquote, figure, listing, p, plaintext, pre, xmp {
  95. margin-top: 1em;
  96. margin-bottom: 1em;
  97. }
  98. blockquote, figure {
  99. margin-left: 40px;
  100. margin-right: 40px;
  101. }
  102. address {
  103. font-style: italic;
  104. }
  105. listing, plaintext, pre, xmp {
  106. font-family: monospace;
  107. white-space: pre;
  108. }
  109. dialog:not([open]) {
  110. display: none;
  111. }
  112. dialog {
  113. position: absolute;
  114. inset-left: 0;
  115. inset-right: 0;
  116. width: fit-content;
  117. height: fit-content;
  118. margin: auto;
  119. border: solid;
  120. padding: 1em;
  121. background-color: Canvas;
  122. color: CanvasText;
  123. }
  124. dialog::backdrop {
  125. background: rgba(0, 0, 0, 0.1);
  126. }
  127. slot {
  128. display: contents;
  129. }
  130. /* 15.3.4 Phrasing content
  131. * https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content-3
  132. */
  133. cite, dfn, em, i, var {
  134. font-style: italic;
  135. }
  136. b, strong {
  137. font-weight: bolder;
  138. }
  139. code, kbd, samp, tt {
  140. font-family: monospace;
  141. }
  142. big {
  143. font-size: larger;
  144. }
  145. small {
  146. font-size: smaller;
  147. }
  148. sub {
  149. vertical-align: sub;
  150. }
  151. sup {
  152. vertical-align: super;
  153. }
  154. sub, sup {
  155. line-height: normal;
  156. font-size: smaller;
  157. }
  158. ruby {
  159. display: ruby;
  160. }
  161. rt {
  162. display: ruby-text;
  163. }
  164. :link {
  165. color: -libweb-link;
  166. }
  167. :visited {
  168. color: -libweb-palette-visited-link;
  169. }
  170. :link:active, :visited:active {
  171. color: -libweb-palette-active-link;
  172. }
  173. :link, :visited {
  174. text-decoration: underline;
  175. cursor: pointer;
  176. }
  177. :focus-visible {
  178. outline: auto;
  179. }
  180. mark {
  181. background: yellow;
  182. color: black;
  183. }
  184. /* this color is just a suggestion and can be changed based on implementation feedback */
  185. abbr[title], acronym[title] {
  186. text-decoration: dotted underline;
  187. }
  188. ins, u {
  189. text-decoration: underline;
  190. }
  191. del, s, strike {
  192. text-decoration: line-through;
  193. }
  194. q::before {
  195. content: open-quote;
  196. }
  197. q::after {
  198. content: close-quote;
  199. }
  200. br {
  201. display-outside: newline;
  202. }
  203. /* this also has bidi implications */
  204. nobr {
  205. white-space: nowrap;
  206. }
  207. wbr {
  208. display-outside: break-opportunity;
  209. }
  210. /* this also has bidi implications */
  211. nobr wbr {
  212. white-space: normal;
  213. }
  214. /* 15.3.5 Bidirectional text
  215. * https://html.spec.whatwg.org/multipage/rendering.html#bidi-rendering
  216. */
  217. [dir]:dir(ltr), bdi:dir(ltr), input[type=tel i]:dir(ltr) {
  218. direction: ltr;
  219. }
  220. [dir]:dir(rtl), bdi:dir(rtl) {
  221. direction: rtl;
  222. }
  223. address, blockquote, center, div, figure, figcaption, footer, form, header, hr,
  224. legend, listing, main, p, plaintext, pre, summary, xmp, article, aside, h1, h2,
  225. h3, h4, h5, h6, hgroup, nav, section, table, caption, colgroup, col, thead,
  226. tbody, tfoot, tr, td, th, dir, dd, dl, dt, menu, ol, ul, li, bdi, output,
  227. [dir=ltr i], [dir=rtl i], [dir=auto i] {
  228. unicode-bidi: isolate;
  229. }
  230. bdo, bdo[dir] {
  231. unicode-bidi: isolate-override;
  232. }
  233. input[dir=auto i]:is([type=search i], [type=tel i], [type=url i],
  234. [type=email i]), textarea[dir=auto i], pre[dir=auto i] {
  235. unicode-bidi: plaintext;
  236. }
  237. /* 15.3.6 Sections and headings
  238. * https://html.spec.whatwg.org/multipage/rendering.html#sections-and-headings
  239. */
  240. article, aside, h1, h2, h3, h4, h5, h6, hgroup, nav, section {
  241. display: block;
  242. }
  243. h1 {
  244. margin-top: 0.67em;
  245. margin-bottom: 0.67em;
  246. font-size: 2.00em;
  247. font-weight: bold;
  248. }
  249. h2 {
  250. margin-top: 0.83em;
  251. margin-bottom: 0.83em;
  252. font-size: 1.50em;
  253. font-weight: bold;
  254. }
  255. h3 {
  256. margin-top: 1.00em;
  257. margin-bottom: 1.00em;
  258. font-size: 1.17em;
  259. font-weight: bold;
  260. }
  261. h4 {
  262. margin-top: 1.33em;
  263. margin-bottom: 1.33em;
  264. font-size: 1.00em;
  265. font-weight: bold;
  266. }
  267. h5 {
  268. margin-top: 1.67em;
  269. margin-bottom: 1.67em;
  270. font-size: 0.83em;
  271. font-weight: bold;
  272. }
  273. h6 {
  274. margin-top: 2.33em;
  275. margin-bottom: 2.33em;
  276. font-size: 0.67em;
  277. font-weight: bold;
  278. }
  279. :is(article, aside, nav, section) h1 {
  280. margin-top: 0.83em;
  281. margin-bottom: 0.83em;
  282. font-size: 1.50em;
  283. }
  284. :is(article, aside, nav, section) :is(article, aside, nav, section) h1 {
  285. margin-top: 1.00em;
  286. margin-bottom: 1.00em;
  287. font-size: 1.17em;
  288. }
  289. :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1 {
  290. margin-top: 1.33em;
  291. margin-bottom: 1.33em;
  292. font-size: 1.00em;
  293. }
  294. :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1 {
  295. margin-top: 1.67em;
  296. margin-bottom: 1.67em;
  297. font-size: 0.83em;
  298. }
  299. :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) :is(article, aside, nav, section) h1 {
  300. margin-top: 2.33em;
  301. margin-bottom: 2.33em;
  302. font-size: 0.67em;
  303. }
  304. /* 15.3.7 Lists
  305. * https://html.spec.whatwg.org/multipage/rendering.html#lists
  306. */
  307. dir, dd, dl, dt, menu, ol, ul {
  308. display: block;
  309. }
  310. li {
  311. display: list-item;
  312. text-align: match-parent;
  313. }
  314. dir, dl, menu, ol, ul {
  315. margin-top: 1em;
  316. margin-bottom: 1em;
  317. }
  318. :is(dir, dl, menu, ol, ul) :is(dir, dl, menu, ol, ul) {
  319. margin-top: 0;
  320. margin-bottom: 0;
  321. }
  322. dd {
  323. margin-left: 40px;
  324. }
  325. dir, menu, ol, ul {
  326. padding-left: 40px;
  327. }
  328. ol, ul, menu {
  329. counter-reset: list-item;
  330. }
  331. ol {
  332. list-style-type: decimal;
  333. }
  334. dir, menu, ul {
  335. list-style-type: disc;
  336. }
  337. :is(dir, menu, ol, ul) :is(dir, menu, ul) {
  338. list-style-type: circle;
  339. }
  340. :is(dir, menu, ol, ul) :is(dir, menu, ol, ul) :is(dir, menu, ul) {
  341. list-style-type: square;
  342. }
  343. /* 15.3.8 Tables
  344. * https://html.spec.whatwg.org/multipage/rendering.html#tables-2
  345. */
  346. table {
  347. display: table;
  348. }
  349. caption {
  350. display: table-caption;
  351. }
  352. colgroup, colgroup[hidden] {
  353. display: table-column-group;
  354. }
  355. col, col[hidden] {
  356. display: table-column;
  357. }
  358. thead, thead[hidden] {
  359. display: table-header-group;
  360. }
  361. tbody, tbody[hidden] {
  362. display: table-row-group;
  363. }
  364. tfoot, tfoot[hidden] {
  365. display: table-footer-group;
  366. }
  367. tr, tr[hidden] {
  368. display: table-row;
  369. }
  370. td, th {
  371. display: table-cell;
  372. }
  373. colgroup[hidden], col[hidden], thead[hidden], tbody[hidden],
  374. tfoot[hidden], tr[hidden] {
  375. visibility: collapse;
  376. }
  377. table {
  378. box-sizing: border-box;
  379. border-spacing: 2px;
  380. border-collapse: separate;
  381. text-indent: initial;
  382. }
  383. td, th {
  384. padding: 1px;
  385. }
  386. th {
  387. font-weight: bold;
  388. }
  389. caption {
  390. text-align: center;
  391. }
  392. thead, tbody, tfoot, table > tr {
  393. vertical-align: middle;
  394. }
  395. tr, td, th {
  396. vertical-align: inherit;
  397. }
  398. thead, tbody, tfoot, tr {
  399. border-color: inherit;
  400. }
  401. table[rules=none i], table[rules=groups i], table[rules=rows i],
  402. table[rules=cols i], table[rules=all i], table[frame=void i],
  403. table[frame=above i], table[frame=below i], table[frame=hsides i],
  404. table[frame=lhs i], table[frame=rhs i], table[frame=vsides i],
  405. table[frame=box i], table[frame=border i],
  406. table[rules=none i] > tr > td, table[rules=none i] > tr > th,
  407. table[rules=groups i] > tr > td, table[rules=groups i] > tr > th,
  408. table[rules=rows i] > tr > td, table[rules=rows i] > tr > th,
  409. table[rules=cols i] > tr > td, table[rules=cols i] > tr > th,
  410. table[rules=all i] > tr > td, table[rules=all i] > tr > th,
  411. table[rules=none i] > thead > tr > td, table[rules=none i] > thead > tr > th,
  412. table[rules=groups i] > thead > tr > td, table[rules=groups i] > thead > tr > th,
  413. table[rules=rows i] > thead > tr > td, table[rules=rows i] > thead > tr > th,
  414. table[rules=cols i] > thead > tr > td, table[rules=cols i] > thead > tr > th,
  415. table[rules=all i] > thead > tr > td, table[rules=all i] > thead > tr > th,
  416. table[rules=none i] > tbody > tr > td, table[rules=none i] > tbody > tr > th,
  417. table[rules=groups i] > tbody > tr > td, table[rules=groups i] > tbody > tr > th,
  418. table[rules=rows i] > tbody > tr > td, table[rules=rows i] > tbody > tr > th,
  419. table[rules=cols i] > tbody > tr > td, table[rules=cols i] > tbody > tr > th,
  420. table[rules=all i] > tbody > tr > td, table[rules=all i] > tbody > tr > th,
  421. table[rules=none i] > tfoot > tr > td, table[rules=none i] > tfoot > tr > th,
  422. table[rules=groups i] > tfoot > tr > td, table[rules=groups i] > tfoot > tr > th,
  423. table[rules=rows i] > tfoot > tr > td, table[rules=rows i] > tfoot > tr > th,
  424. table[rules=cols i] > tfoot > tr > td, table[rules=cols i] > tfoot > tr > th,
  425. table[rules=all i] > tfoot > tr > td, table[rules=all i] > tfoot > tr > th {
  426. border-color: black;
  427. }
  428. /* 15.3.10 Form controls
  429. * https://html.spec.whatwg.org/multipage/rendering.html#form-controls
  430. */
  431. input, select, button, textarea {
  432. letter-spacing: initial;
  433. word-spacing: initial;
  434. line-height: initial;
  435. text-transform: initial;
  436. text-indent: initial;
  437. text-shadow: initial;
  438. appearance: auto;
  439. }
  440. input, select, textarea {
  441. text-align: initial;
  442. }
  443. input:is([type=reset i], [type=button i], [type=submit i]), button {
  444. text-align: center;
  445. }
  446. input, button {
  447. display: inline-block;
  448. }
  449. input[type=hidden i], input[type=file i], input[type=image i] {
  450. appearance: none;
  451. }
  452. input:is([type=radio i], [type=checkbox i], [type=reset i], [type=button i],
  453. [type=submit i], [type=color i], [type=search i]), select, button {
  454. box-sizing: border-box;
  455. }
  456. textarea {
  457. white-space: pre-wrap;
  458. }
  459. /* 15.3.11 The hr element
  460. * https://html.spec.whatwg.org/multipage/rendering.html#the-hr-element-2
  461. */
  462. hr {
  463. color: gray;
  464. border-style: inset;
  465. border-width: 1px;
  466. margin: 0.5em auto;
  467. overflow: hidden;
  468. }
  469. /* 15.3.12 The fieldset and legend elements
  470. * https://html.spec.whatwg.org/multipage/rendering.html#the-fieldset-and-legend-elements
  471. */
  472. fieldset {
  473. display: block;
  474. margin-left: 2px;
  475. margin-right: 2px;
  476. border: groove 2px ThreeDFace;
  477. padding: 0.35em 0.75em 0.625em;
  478. min-inline-size: min-content;
  479. }
  480. legend {
  481. padding-left: 2px;
  482. padding-right: 2px;
  483. }
  484. legend[align=left i] {
  485. justify-self: left;
  486. }
  487. legend[align=center i] {
  488. justify-self: center;
  489. }
  490. legend[align=right i] {
  491. justify-self: right;
  492. }
  493. /* 15.4.1 Embedded content
  494. * https://html.spec.whatwg.org/multipage/rendering.html#embedded-content-rendering-rules
  495. */
  496. iframe {
  497. border: 2px inset;
  498. }
  499. video {
  500. object-fit: contain;
  501. }
  502. /* 15.5.4 The details and summary elements
  503. * https://html.spec.whatwg.org/multipage/rendering.html#the-details-and-summary-elements
  504. */
  505. summary {
  506. display: list-item;
  507. counter-increment: list-item 0;
  508. list-style: disclosure-closed inside;
  509. }
  510. details[open] > summary {
  511. list-style-type: disclosure-open;
  512. }
  513. /* 15.5.12 The marquee element
  514. * https://html.spec.whatwg.org/multipage/rendering.html#the-marquee-element-2
  515. */
  516. marquee {
  517. display: inline-block;
  518. text-align: initial;
  519. }
  520. /* 15.5.13 The meter element
  521. * https://html.spec.whatwg.org/multipage/rendering.html#the-meter-element-2
  522. */
  523. meter {
  524. appearance: auto;
  525. }
  526. /* 15.5.14 The progress element
  527. * https://html.spec.whatwg.org/multipage/rendering.html#the-progress-element-2
  528. */
  529. progress {
  530. appearance: auto;
  531. }
  532. /* https://www.w3.org/TR/mediaqueries-5/#descdef-media-inverted-colors
  533. */
  534. @media (inverted-colors) {
  535. img:not(picture>img),
  536. picture,
  537. video {
  538. filter: invert(100%);
  539. }
  540. }
  541. /* This is the same as default intrinsic size of a <progress> element */
  542. progress {
  543. width: 300px;
  544. height: 12px;
  545. }
  546. /* The default progress-value/bar CSS below is the same as Blink/WebKit.
  547. * Note: Setting any more than the backgrond-color may have unintended consequences, as sites don't expect to unset more than that.
  548. */
  549. progress::-webkit-progress-bar {
  550. width: inherit;
  551. height: inherit;
  552. background-color: grey;
  553. }
  554. progress::-webkit-progress-value {
  555. height: inherit;
  556. background-color: green;
  557. }