Hot answers tagged

2

Well, there are a lot of things that come up to my mind but the first is that your CSS is overloaded with media queries. Ideally a well-structured CSS should have not so many declarations in the media queries, because you should choose a fluid approach from the beginning. You should choose also if using a desktop-first or mobile-first approach. Your most ...


2

You could make a few adjustments to your code: Positioning looks inconsistent here. Make sure to set your parent element's position to relative. An absolutely positioned element is positioned relative to its parent. If there is no such parent, it is positioned relative to the window, just like in your example. Add z-index to make ornaments and lights ...


2

Adding elements As pointed out in "CertainPerformance's" answer adding content via HTML in this case can present a security risk. However adding elements via innerHTML should always be avoided as it is very inefficient, noisy, and hard to read and maintain (due to there being no code formatting in a string) With a few simple functions you can avoid ...


1

Use const when possible - using let is a warning to readers of the code that a variable may get reassigned in the future. If that's not actually the case, better to use const for the removed variable; consider a linter. removed array? Its purpose isn't entirely clear at first glance, I had to read over a few sections of the code to understand what it's doing....


1

Pretty good code, I'd remove variable isListEmpty as it does nothing at all, your if else branch already checks for empty list and you get rid of one ugly global variable. Consider getting rid of all the global variables by wrapping functions, that need them into either into class or another function. that way variables are not global, and you can even pass ...


1

There is! You can use :nth-child() with plenty of ways to select children elements of particular wrapper, for example odd or even elements, a range of elements, 3 elements after 4 other elements and repeat. Check this generator to create a rule and help you visualize what elements will be selected: https://css-tricks.com/examples/nth-child-tester/ Docs: ...


1

No, it does not make sense; the goal of SASS is to make things dry and maintainable. There's no point in writing: nav ul { @include py(1); } instead of: nav ul { padding-top: 1rem; padding-bottom: 1rem; } or: nav ul { padding: 1rem 0; } With your mixing you are not writing less code and you make it sightly less readable. Furthermore you should ...


1

There are many things that, honestly, I don't consider best practices. In detail: a) Using a grid seems not necessary there: such a structure could be realised with flex box only. It would have better compatibility. b) I can't tell if nesting grids is considered a best practice either but this code does not get advantage of SASS in its nesting. Classes ...


Only top voted, non community-wiki answers of a minimum length are eligible