C_7
KPCKevin Powell - Community
•Created by Vandana on 8/22/2024 in #front-end
Math in JS.
emm....
This should not happen, because the first line of the function performs the number conversion operation.
161 replies
KPCKevin Powell - Community
•Created by Vandana on 8/22/2024 in #front-end
Math in JS.
There are two errors in this function
1. Obtaining the value of decResult
2. Calculation formula for <40
First, let’s talk about problem 1:
You will find that your input may have one or two decimal places.
When there are two decimal places, the value calculated by decResult is correct.
When there is one decimal place, decResult is obviously incorrect, which is why the final result is wrong
—————————————————————————————
Decimal part Actual Expected
—————————————————————————————
0.99 99 99
0.05 5 5
0.5 5 50
—————————————————————————————
Let’s talk about problem 2:
The following is your code
You will find that your calculation formula is the same as directly [num + 10], there is no difference,
because you finally take a floating point number for calculation,
instead of converting it into a floating point number that is 100 times smaller after the calculation is completed
As Kirin-808 said, You probably want .toFixed() to handle that kind of stuff.
161 replies
KPCKevin Powell - Community
•Created by Shadow_Lurker on 8/5/2024 in #front-end
Can someone explain to me why this is happening?
28 replies
KPCKevin Powell - Community
•Created by Ellie <3 on 8/1/2024 in #front-end
How to define max width of flex grow container
1、Understand flex-grow and flex-shrink.
2、Understand the meaning of the flex shorthand.
see:
https://developer.mozilla.org/en-US/docs/Web/CSS/flex#constituent_properties
3 replies
KPCKevin Powell - Community
•Created by Abc on 7/31/2024 in #front-end
How can I ensure that the container is at least as wide as the longest text?
If you are training html, css
You can take a look at this
https://codepen.io/Q-C_Q-C/pen/gONgJEW
Or try using a UI framework to do it
https://ui.shadcn.com/docs/components/dropdown-menu
7 replies
KPCKevin Powell - Community
•Created by anes039 on 7/23/2024 in #front-end
Responsive Layout
simple example:
https://codepen.io/Q-C_Q-C/pen/JjQKVyV
22 replies
KPCKevin Powell - Community
•Created by Boeroe on 11/6/2023 in #front-end
Mobile nav bar
There is a difference between these two ways of writing.
The reason for this problem is that the box element will occupy a full line by default.
It is recommended to add this at the beginning of the code
10 replies
KPCKevin Powell - Community
•Created by Boeroe on 11/6/2023 in #front-end
Mobile nav bar
That's because you gave a big margin
10 replies
KPCKevin Powell - Community
•Created by Bardacoon on 11/6/2023 in #front-end
Grid as a child of a flex doesn't work properly
5 replies
KPCKevin Powell - Community
•Created by filipniik on 11/6/2023 in #front-end
Maybe a stupid question..
I wrote test code and your problem does not occur.
You can take a look at this, it looks pretty good.
https://marketplace.visualstudio.com/items?itemName=yandeu.five-server
6 replies
KPCKevin Powell - Community
•Created by filipniik on 11/6/2023 in #front-end
Maybe a stupid question..
6 replies
KPCKevin Powell - Community
•Created by imTypθ on 11/4/2023 in #front-end
Vertical squishing of elements even with overflow-y: scroll
Although it looks okay, there are still many problems inside
6 replies
KPCKevin Powell - Community
•Created by imTypθ on 11/4/2023 in #front-end
Vertical squishing of elements even with overflow-y: scroll
Your code looks like a layout exercise.
There seems to be a lot of unnecessary padding, margin, width, and height.
When you make grid constraints, you should consider whether it is necessary to declare the dimensions of the elements.
6 replies
KPCKevin Powell - Community
•Created by imTypθ on 11/4/2023 in #front-end
Vertical squishing of elements even with overflow-y: scroll
6 replies
KPCKevin Powell - Community
•Created by imTypθ on 11/4/2023 in #front-end
Vertical squishing of elements even with overflow-y: scroll
6 replies
KPCKevin Powell - Community
•Created by Como on 10/10/2023 in #front-end
Anyone knows how to achieve this design?
+1
6 replies
KPCKevin Powell - Community
•Created by Jus Sus || 💀 on 10/11/2023 in #front-end
How to make this heart icon
'Font icons' || 'canvas'
20 replies
KPCKevin Powell - Community
•Created by Saagy on 10/7/2023 in #front-end
Twitter clone problem
You can try this. This is the problem of html and css layout.
14 replies
KPCKevin Powell - Community
•Created by Saagy on 10/7/2023 in #front-end
Twitter clone problem
14 replies