Could not figure out how to get the image purple.
Ruan Esterhuyse
@RuanEsterhuyseAll comments
- @shaughnroqueSubmitted over 2 years ago@RuanEsterhuysePosted over 2 years ago
Hi!
Your solution looks good.
Here is one suggestion on what you can add to your code to get the image purple.
I hope it will be helpful. Happy coding!
.main-span { font-size: 3.5rem; color: #ab5cdb; } .item-2 { display: flex; position: relative; } .item-2::after { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0.6; background-color: hsl(277, 88%, 33%); border-radius: 0 10px 10px 0; }
Marked as helpful1 - @louisenorrsenSubmitted over 2 years ago
Hi! I'm happy with the result and I learned new things!
I want to know how I can use em and rem and not use px and still match the design. Does it matter if you don't want the component to change size?
Thanks!
@RuanEsterhuysePosted over 2 years agoHi Louise,
Your solution looks great!
I will try to answer your question if I understand it correctly. You can use
rem
andem
units instead ofpx
and still match the design without affecting any changes in the size of the elements.Rem
is only relative to theHTML (root)
default browser font size. The default font size is16px
.Em
is relative to the font size of its parent element.So,
1rem
is equal to16px
,2rem
is equal to32px
,3rem
is equal to48px
and so on. For example, if you want to changepx
torem
for a font size of20px
, it'll be20/16=1.25rem.
If you want to use
em
, divide it by the parent element's font size. If the parent element's font-size is50px
, then1em = 50px
. So, for20px
it will be20/50 = 0.4em.
You can also specify a font size on the
HTML
element, which would make it easier to do the calculations.For example, you can set the font size to
10px
on theHTML
element. That will change the entire layout because it automatically changes all the lengths defined anywhere with therem
unit.1rem
will no longer be16 pixels
. It will be10 pixels
. So,20px
will be20/10 = 2rem
. However, you should not set it to a fixed value like10px
because the root font size will always be10px
. That will create usability problems for users who increase or decrease the font size of their browsers. Therefore, it is better to set it to a percentage of the default font size.10px
divided by16px = 62.5%
.html { font-size: 62.5%; }
Then,
10px
is equal to1rem
,20px
is equal to2rem
and so on.Marked as helpful0 - @RuanEsterhuyseSubmitted over 2 years ago
Hello everybody. Any feedback would be appreciated!
- @RuanEsterhuyseSubmitted almost 3 years ago
Hello everyone! Any feedback on my solution will be appreciated!
@RuanEsterhuysePosted almost 3 years agoThanks for the feedback! I appreciate it.
0 - @RuanEsterhuyseSubmitted almost 3 years ago
Hello everyone! Any feedback on my solution would be much appreciated!
@RuanEsterhuysePosted almost 3 years agoThanks for taking the time to give me such valuable feedback. I appreciate it.
0 - @RuanEsterhuyseSubmitted almost 3 years ago
Hello everyone! Any feedback on my solution would be much appreciated!
@RuanEsterhuysePosted almost 3 years agoThanks for the feedback! I fixed the accessibility issues. What can I do to get the exact positioning right?
0