Hi! this is my solution for the tip calculator project. I struggled with the custom button (updating the value for that) and the updating of values when the input changes. Is there a smart way of doing this?
Eray
@ErayBarslanAll comments
- @MaritxxSubmitted about 2 years ago@ErayBarslanPosted about 2 years ago
Hey, great work on the challenge! You can use
input
eventListener to achieve that. For custom input it would be:document.getElementById("custom__button").addEventListener('input', (e) => { calculateTipAmount(e, e.target.value / 100) })
You can apply the same to other inputs. Happy coding :)
0 - @catherineisonlineSubmitted about 2 years ago
Hello, Frontend Mentor community! This is my solution to the Crowdfunding product page.
I appreciate all the feedback you left that helped me to improve this project. Due to the fact that I published this project very long ago, I am no longer updating it and changing its status to Public Archive on my Github.
You are free to download or use the code for reference in your projects, but I no longer update it or accept any feedback.
Thank you
@ErayBarslanPosted about 2 years agoHey Catherine, excellent work on the challenge! There is just a little gotcha about
background-size
. Header has fixed height socontain
won't let the image grow as the screen gets wider. Everything else looks perfect, happy coding :)0 - @DHolets99Submitted about 2 years ago
Finally finished this challenge. There were difficulties with the positioning of the main image. Feedback is welcome
@ErayBarslanPosted about 2 years agoHey Darya, design is almost pixel perfect and responsive so nothing much to add, excellent work! Some suggestions:
- Between 450-720px text and image overlaps. You can change the breakpoint for mobile to 720px. My general suggestion in this regard would be to take mobile first approach so you wouldn't be dealing overflows. Also desktop layouts are more complex than mobile. So you can achieve the same result with less code since mobile usually just 1 column layout. Although you'd still need to check desktop before styling for mobile to make the transition easier from simple layout to complex.
- Sections aren't landmark elements by default. If you wish to use as one, you need
aria-label
ortitle
attributes. Or you can simply use it inside<main>
. - You can reduce the usage of <div>. If there is a semantic element it's always better to use one instead of div. In your case you can use
<p>
for texts. Also you can get rid of nested divs like in here:
<header> <div class="wrapper"> <div class="header"> /* content */ </div> </div> </header>
All 3 containers are parent of the content and you can achieve the same by just using
<header>
without the need of divs. In regards of accessibility nested divs won't mean much because they're ignored, just there for styling purposes. Although not using unnecessary elements will keep your code more maintainable and easier to work on for others. Aside these everything looks great and happy coding :)0 - @andykallianSubmitted about 2 years ago
Hello!
It's my first time trying to implement a dark mode theme, and it was more difficult than i've thought.
First of all, creating an empty div and then populate it with classes and events through JS code required a lot of attention as they were "a div inside another div inside another div...and so on"
after, I couldn't turn 'checkbox' input into rounded instead a square box, so I created a div (through JS) and then put a style on it in css. Visually speaking, it worked! Functionally speaking? well...I can't confirm this since I still haven't added the functionality to confirm the check by the user.
Anyway, my logic in JS seems to be working, but I don't believe it's following good patterns.
if anyone can give any suggestions related to the whole project, it will be welcome and I will be grateful!
I hope you enjoy it! Regards!
P.S: I still intend implement media queries, but for now it's ok
@ErayBarslanPosted about 2 years agoHey Anderson. Great work on your solution! To use checkbox and style as you wish you can use
appearance: none
. This is what I've used on my solution:.theme-switch { appearance: none; width: 26px; height: 26px; background-image: url('images/icon-sun.svg'); background-repeat: no-repeat; cursor: pointer; } .theme-switch:checked { background-image: url('images/icon-moon.svg'); background-position: center; }
Also you can define just one class per theme on body. Example:
.dark { --bg-color: hsl(235, 21%, 11%); --bg-content: hsl(235, 24%, 19%); } .light { --bg-color: rgb(235, 235, 235); --bg-content: white; }
Then add & remove with checkbox. You can use the variables on any element, switching class from body will be enough. Would make it much more easier to store in localStorage as well. Happy coding :)
1 - @trandainienSubmitted about 2 years ago
All comments are welcome
@ErayBarslanPosted about 2 years agoHey there, congrats on your solution! Design looks good, responsive and you have clean usage of CSS. Nothing much to add but some suggestions:
- If you wish to place the attribution to bottom of page without effecting your container's placement you can use:
.attribution { ... position: absolute; bottom: 0; } body { ... justify-content: center; } /* In this case you can place your container to center */
- Background color is missing on body:
background-color: var(--Very-light-gray);
Although arguably white looks better so you might as well leave it as it is. - Instead using <div> on
.container
and.attribution
you can use semantic elements to make the page accessible:<main class="container">
&<footer class="attribution">
- You shouldn't leave
alt
empty. Screen readers skips empty alt. Since images on this challenge are for decorative usage, nothing wrong regarding accessibility. But your page might get lower SEO. Instead you can use like :<img src="./images/icon-sedans.svg" alt="sedan" aria-hidden="true"/>
- On production, when you dirct links with
target="_blank"
, addingrel="noopener noreferrer"
will make it secure to attacks. Aside these nothing I'd add, happy coding :)
Marked as helpful1 - @AleromsSubmitted about 2 years ago
How's my scss structure?
@ErayBarslanPosted about 2 years agoHey there, excellent work with the challenge! Design looks good and accessible. Your scss usage looks alright and for such project you won't need more of it's features. By the time projects starts getting bigger you can start structuring your scss files like _variables, _mixins and import to main. But would be redundant for this one. Some suggestions.
- Right now your card isn't responsive and that is due to the fixed
width: 375px
value on container. If you usemax-width
you'll see it's responsive for smaller screens aswell. By defaultwidth: auto
which is taking available space to fit the content inside it. In this case you can increase the value to match the desktop design by keeping it same for 375 screen width:max-width: 450px;
- There is a vertical scrollbar even though nothing overflows. That's due to the default margin on body. If you give
margin: 0
to body it'll fix that. For your next projects I'd suggest resetting all padding and margin at the start of your project by using* { ... }
selector. So you'd have full control over your elements. Aside these nothing I'd add, happy coding :)
Marked as helpful1 - Right now your card isn't responsive and that is due to the fixed
- @stepheigbeSubmitted over 2 years ago
How do i makes sure the coded by stays at the bottom?
@ErayBarslanPosted over 2 years agoHey there, great work on your solution! To place attribution on bottom and not effect the rest of your layout you can use:
.attribution { font-size: 11px; position: absolute; bottom: 0; }
Absolute positions the element relative to it's parent without effecting any other element. Since parent of attribution is the main, you'd want to move it out of main and make it's parent body. To keep it semantic, you can use
<footer>
on attribution instead of div. Hope this answers your questions, happy coding :)0 - @nekokanbaruSubmitted over 2 years ago
I tried to input the close button svg using svgsprite to change the color on hover, but when I did it the element was there but you couldn't see the icon, so I changed it back to a regular img.
Another problem I had is that I could load tasks from local JSON but not save them, I looked it up on google but everywhere I looked people were using node, so if someone knows any other way I could do that I would be grateful if someone could tell me.
Otherwise it was a very fun project.
@ErayBarslanPosted over 2 years agoHello Sylvanas! Great work on the challenge. It's responsive and everything works fine.
- You can use
visibility:hidden
by default and turn it to visible on hover to achieve that effect. - To save data if you're not down to use a database which would be too much for this challenge, your option is
localStorage
. Whenever user creates a todo you can use localStorage.setItem() method to save the data and call with localStorage.getItem() method. You'd need some checking but it's pretty straightforward. If you wish to see on usage you can check my solution of the challenge which I used localStorage: Todo App. Hope these answers your questions, happy coding :)
Marked as helpful1 - You can use
- @AmanGupta1703Submitted over 2 years ago
.container::before { content: ""; background: url("/images/pattern-background-desktop.svg") center center/contain; position: absolute; width: 100%; height: 26rem; top: 0; left: 0; z-index: -1; } I am able to see the output of the above code in the visual studio live server, but I can't see it in the GitHub live page.
I would like to hear your feedback! 😊
@ErayBarslanPosted over 2 years agoHey there, nice work with your solution! Some suggestions:
- Regarding html structure, you have 3 nested <div> containers which you can achieve the same result by just using one. You can simply remove
.summary-box
without effecting the design. Removing.container
will require little refactoring but you can remove anything related to that. - Using background on container breaks it's design on screen change. Using on body would be better option. After removing these elements from html you can use:
body { ... background: url("/images/pattern-background-desktop.svg"); background-repeat: repeat-x; } .summary-item { ... width: 90%; max-width: 414px; }
As you can see, just adding
max-width
is enough to achieve the same thing. You can also lower the need of media-query by adjusting%
values for the mobile version, then give it amax-width
. This approach is also preventing content overflowing between 375-550px due towidth: 48%
.- Lastly, now we have just
.summary-item
as container, you can use<main>
on it instead div to be semantically right. Aside these good work again and happy coding :)
Marked as helpful1 - Regarding html structure, you have 3 nested <div> containers which you can achieve the same result by just using one. You can simply remove
- @satzzzzz07Submitted over 2 years ago
Hey All, Open to feedback and suggestions!!
@ErayBarslanPosted over 2 years agoHey there, excellent work on your solution! Design looks good and everything works as supposed to. My suggestions:
- Functions fire on input change with key, however nothing happens when numbers changed by spin box. You can listen to input change through javascript. There is oninput listener on html but doesn't work same way:
bill.addEventListener("input", () => { billGen(); renderBill() }) customTip.addEventListener("input", () => { customTipGenerator(); renderBill() }) people.addEventListener("input", () => { peopleCountGenerator(); renderBill() }) /* Since there are two functions for each listener, we put them inside another function. */
- Alternatively if you wish to not deal with spin box you can simply use text which is the general convention and you're already converting input by Number(x). Also on modern browsers to remove spin box from number input you can add to css:
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; } input[type="number"] { -moz-appearance: textfield; }
- Instead of <h2> It'd be better use
<h1>
for the heading of page. If there are several heading then It'd be applicable to use other headings. - For
.attribution
you can use<footer>
instead <div>. Aside these excellent work again and happy coding :)
Marked as helpful0 - @Luis-OliveroSubmitted over 2 years ago
How do I get rid of the space between the profile picture and the profile name/age?
How do I get rid of the space between the stats and the text under the stats?
Thanks for all the feed back!
@ErayBarslanPosted over 2 years agoHey Luis. Great work on your solution! It's responsive and accessible. I've looked into your code and the issue comes from
top
attribute on img. You can fix it by changing it tomargin-top
:.card__img--picture img { position: relative; margin-top: -3rem; border: 6px solid #fff; }
When top attribute used, base position of the element stays same, just visually effects it's positioning. Using margin simply fixes that. For your second issue, it's due to the default margin of h2 and p. You can fix by using: h2, p {margin: 0;} To not deal with default margin, padding at the beginning of CSS in addition to box-sizing I'd suggest adding:
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
Aside these perfect solution and happy coding :)
Marked as helpful1 - @amaar09Submitted over 2 years ago
Updated...
@ErayBarslanPosted over 2 years agoHey there, excellent work on this one! Regarding your question, another option would be adding a return button. You can use setTimeout here but it displays only for 1,5 seconds which isn't enough for the user to read the page. It's better to use a higher value. Additional suggestions:
- Right now user can submit without selecting a rate and it returns undefined value. To prevent this you can add an if state to your submit event listener function like:
submit.addEventListener("click", () => { if (a) { /* your entire function */ } })
- On screens smaller than 400px, content overflows out of body. That is due to using fixed width value. Instead you can use
max-width: 385px;
to make your container responsive. By default it'swidth: auto
which is taking the available space without overflowing. Giving fixed width overrides this. Aside these nothing much I'd add and happy coding :)
Marked as helpful0