├── CONTRIBUTING.md
├── CSS.md
├── HTML.md
├── JAVASCRIPT.md
├── LICENSE
└── README.md
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Thank you! ❤️
2 |
3 | Thank you for contributing to our awesome tips.
4 |
5 | ## Guidelines
6 |
7 | - **One item** per Pull Request.
8 |
9 | - Pull request should include a title which describes the tip, an optional short description, code and an optional link to the codepen.
10 |
11 |
12 | Example:
13 |
14 |
15 | ## Fieldset Element
16 |
17 | You can use `
36 |
37 | - Don't forget to add an anchor link in the table of contents. The format of the link should be like this: - `[Base Element](#base-element)`.
38 |
39 | - Don't open issues with new tips, open a PR instead.
40 |
41 | ## Thank you! ❤️
42 |
--------------------------------------------------------------------------------
/CSS.md:
--------------------------------------------------------------------------------
1 | # Awesome CSS Tips ![Awesome][awesome-badge]
2 |
3 | #### Contents
4 |
5 | - [Cursors](#cursors)
6 | - [Smooth Scrolling](#smooth-scroll)
7 | - [Truncate Text](#truncate-text)
8 | - [Truncate Text To The Specific Number Of Lines](#truncate-text-to-the-specific-number-of-lines)
9 | - [Calc Function](#calc-function)
10 | - [CSS-only modals](#css-only-modals)
11 | - [Center anything](#center-anything)
12 | - [Sticky sections](#sticky-sections)
13 | - [:empty selector](#empty-selector)
14 |
15 | ## Cursors
16 |
17 | Did you know that you can use your own image, or even emoji as a cursor?
18 |
19 | ```css
20 | div {
21 | cursor: url('path-to-image.png'), url('path-to-fallback-image.png'), auto;
22 | }
23 | ```
24 |
25 | [Link to Codepen](https://codepen.io/denic/pen/bGVpOPj)
26 |
27 | ## Smooth Scroll
28 |
29 | Smooth scrolling without #javascript, with just one line of CSS.
30 |
31 | ```css
32 | html {
33 | scroll-behavior: smooth;
34 | }
35 | ```
36 |
37 | [Link to Codepen](https://codepen.io/denic/pen/bGVeYqN)
38 |
39 | ## Truncate Text
40 |
41 | Did you know that you can truncate text with plain CSS?
42 |
43 | ```css
44 | .overflow-truncate {
45 | text-overflow: ellipsis;
46 | }
47 | ```
48 |
49 | [Link to Codepen](https://codepen.io/denic/pen/LYpZKMg)
50 |
51 | ## Truncate Text To The Specific Number Of Lines
52 |
53 | You can use `-webkit-line-clamp` property to truncate the text to the specific number of lines. An ellipsis will be shown at the point where the text is clamped.
54 |
55 | ```css
56 | .overflow-truncate {
57 | display: -webkit-box;
58 | -webkit-box-orient: vertical;
59 | -webkit-line-clamp: 3;
60 | overflow: hidden;
61 | }
62 | ```
63 |
64 | [Link to Codepen](https://codepen.io/denic/pen/pojEKGX)
65 |
66 | ## Calc Function
67 |
68 | The `calc()` CSS function lets you perform calculations when specifying CSS property values.
69 |
70 | ```css
71 | div {
72 | width: calc(100% - 30px);
73 | }
74 | ```
75 |
76 | ## CSS-only modals
77 |
78 | You can use the :target pseudo-class to create modals with zero JavaScript.
79 |
80 | ```css
81 | .modal {
82 | visibility: hidden;
83 | }
84 |
85 | /*
86 | Selects an element with an id matching the current URL's fragment
87 | Example: example.com#demo-modal
88 | */
89 | .modal:target {
90 | visibility: visible;
91 | }
92 | ```
93 |
94 | [Link to Codepen](https://codepen.io/denic/pen/ZEbKgPp)
95 |
96 | ## Center anything
97 |
98 | Easily center anything, horizontally and vertically, with 3 lines of CSS.
99 |
100 | ```css
101 | .parent {
102 | display: flex;
103 | align-items: center;
104 | justify-content: center;
105 | }
106 | ```
107 |
108 | ## Sticky sections
109 |
110 | You can create sticky section headers with 2 lines of CSS.
111 |
112 | ```css
113 | .sticky {
114 | position: sticky;
115 | top: 0;
116 | }
117 | ```
118 |
119 | [Link to Codepen](https://codepen.io/denic/pen/jObYpaP)
120 |
121 | ## `:empty` selector
122 |
123 | You can use the `:empty` selector to style an element that has no children or text at all:
124 |
125 | ```css
126 | .box {
127 | background: #999;
128 | }
129 |
130 | .box:empty {
131 | background: #fff;
132 | }
133 | ```
134 |
135 | [Link to Codepen](https://codepen.io/denic/pen/KKMpZdP)
136 |
137 | [awesome-badge]: https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg
138 |
139 |
--------------------------------------------------------------------------------
/HTML.md:
--------------------------------------------------------------------------------
1 | # Awesome HTML Tips ![Awesome][awesome-badge]
2 |
3 | #### Contents
4 |
5 | - [HTML Native Search](#html-native-search)
6 | - [Fieldset Element](#fieldset-element)
7 | - [Window Opener](#window-opener)
8 | - [Base Element](#base-element)
9 | - [Details Element](#details-element)
10 | - [Live Reload](#liveReload)
11 |
12 | ## HTML Native Search
13 |
14 | ```html
15 |
16 |
17 | Native HTML Search
18 |
19 |
20 |
21 |
22 |
29 |
30 | ```
31 |
32 | [Link to Codepen](https://codepen.io/denic/pen/WNQbvbo)
33 |
34 | ## Fieldset Element
35 |
36 | You can use