mirror of
https://github.com/Hopiu/bowser.git
synced 2026-03-16 19:10:24 +00:00
- Added a comprehensive CSS parser with support for tag, class, and ID selectors. - Implemented property declaration parsing and inline style handling. - Introduced a Selector class for specificity calculation and matching against HTML elements. - Created a CSSRule class to represent individual CSS rules. - Developed a StyleResolver class to compute final styles for elements, considering cascade and inheritance. - Added integration tests for CSS parsing and style application in HTML documents. - Updated HTML parser to retain <style> tags for CSS extraction. - Enhanced tests for CSS parsing, inline styles, and computed styles.
89 lines
1.4 KiB
CSS
89 lines
1.4 KiB
CSS
/* Default user-agent stylesheet - inspired by water.css */
|
|
|
|
* {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
line-height: 1.6;
|
|
margin: 8px;
|
|
padding: 0;
|
|
color: #333;
|
|
background-color: #cf5959;
|
|
font-size: 16px;
|
|
}
|
|
|
|
h1, h2, h3, h4, h5, h6 {
|
|
font-weight: 600;
|
|
margin-top: 1.5rem;
|
|
margin-bottom: 0.5rem;
|
|
line-height: 1.2;
|
|
}
|
|
|
|
h1 { font-size: 2.5rem; }
|
|
h2 { font-size: 2rem; }
|
|
h3 { font-size: 1.75rem; }
|
|
h4 { font-size: 1.5rem; }
|
|
h5 { font-size: 1.25rem; }
|
|
h6 { font-size: 1rem; }
|
|
|
|
p {
|
|
margin-top: 0;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
a {
|
|
color: #0066cc;
|
|
text-decoration: none;
|
|
}
|
|
|
|
a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
ul, ol {
|
|
margin-top: 0;
|
|
margin-bottom: 1rem;
|
|
padding-left: 2rem;
|
|
}
|
|
|
|
li {
|
|
margin-bottom: 0.25rem;
|
|
}
|
|
|
|
blockquote {
|
|
margin: 1rem 0;
|
|
padding-left: 1rem;
|
|
border-left: 4px solid #ddd;
|
|
color: #666;
|
|
}
|
|
|
|
code, pre {
|
|
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
|
|
font-size: 0.9em;
|
|
background-color: #f5f5f5;
|
|
padding: 0.2em 0.4em;
|
|
border-radius: 3px;
|
|
}
|
|
|
|
pre {
|
|
padding: 1rem;
|
|
overflow-x: auto;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
strong, b {
|
|
font-weight: 600;
|
|
}
|
|
|
|
em, i {
|
|
font-style: italic;
|
|
}
|
|
|
|
hr {
|
|
border: none;
|
|
border-top: 1px solid #ddd;
|
|
margin: 2rem 0;
|
|
}
|