What is the best practice for styling heading?
See original GitHub issueHi guys, been trying styled-components for a few days. Soooo great!
BTW, I have something to ask here, Is this kind code is a good approach?
// @flow
import { rem } from 'polished';
import styled, { css } from 'styled-components';
const baseStyles = css`
color: ${props => props.theme.colors.black || '#222'};
line-height: 1.2;
`;
const H1 = styled.h1`
${baseStyles}
font-size: ${rem('33px')};
`;
const H2 = styled.h2`
${baseStyles};
font-size: ${rem('28px')};
`;
const H3 = styled.h3`
${baseStyles};
font-size: ${rem('23px')};
`;
const H4 = styled.h4`
${baseStyles};
font-size: ${rem('19px')};
`;
const Heading = {
H1,
H2,
H3,
H4,
};
module.exports = Heading;
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
HTML Heading Tags Best Practices - Medium
Best Practices Are Simple: · Make sure you use H1 Heading · Always Nest headings by their level. · Keep most important heading...
Read more >Headings - Web Best Practices | Western Kentucky University
Heading best practices for the WKU website. Information about ordering, heading styles, and secondary heading text.
Read more >5 cool CSS header styles with cross-browser compatibility
Useful tips for styling header texts · Pick the right colors · Make it unique · Use the right fonts · Check compatibility....
Read more >14 CSS Best Practices for Beginners - Kinsta
Today, we'll highlight 14 CSS best practices for beginners, but even experienced professionals should brush up on the basics sometimes.
Read more >6 CSS Best Practices to Follow in 2021 - X-Team
6 CSS Best Practices to Follow in 2021 · Keep It Organized · Make It Understandable · Keep It Short · Use a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Using
as
and a “level”prop
to have one Component for h1-h5Just in case anyone stumbles on here in future, ‘extendWith’ has been renamed to ‘withComponent’. https://www.styled-components.com/docs/api#withcomponent
So this:
Is now this: