Default.css 16 KB

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