These are chat archives for FreeCodeCamp/HelpFrontEnd

1st
Sep 2018
Lia-Sue-Kim
@Lia-Sue-Kim
Sep 01 2018 19:27
is there a way to use object-fit property with background image?
korzo
@korzo
Sep 01 2018 19:34
@Lia-Sue-Kim background-size
I'm trying cover it doesn't show the entire image and when I use contain
its size half of screen while the parent 's width is full screen
I don't know if we can give to background image width and height?
like as percentage
Morchid Chellali
@Morched23MJ
Sep 01 2018 19:39

I don't understand the Regular Expressions: Reuse Patterns Using Capture Groups lesson. Here is the solution:

let repeatNum = "42 42 42";
let reRegex = /^(\d+)\s\1\s\1$/; // Change this line
let result = reRegex.test(repeatNum);

And it is said to

Use capture groups in reRegex to match numbers that are repeated only three times in a string, each separated by a space.

I don't understand the solution and this RegEx feature. :l

korzo
@korzo
Sep 01 2018 19:40
@Lia-Sue-Kim it's because ratio of your image is different of the shape of div
try to use some 16:9 image
you can use percentage with background-size
background-size: 50% 50%
but it will not solve your problem.
you can try absolutely positioned image under div with object-fit
Lia-Sue-Kim
@Lia-Sue-Kim
Sep 01 2018 19:43
i didnt get this 16:8 numbers
positioning shows specific part of image in background
korzo
@korzo
Sep 01 2018 19:51
16:9 (I had a typo) is pixel ratio of image
01_faking_it.jpg
korzo
@korzo
Sep 01 2018 20:05
@Morched23MJ \1 will match result of first capture group
Lia-Sue-Kim
@Lia-Sue-Kim
Sep 01 2018 20:05
@korzo what units do you mean?
it looks like browser and device view
korzo
@korzo
Sep 01 2018 20:06
@Morched23MJ 1. capture group is (\d+)
Morchid Chellali
@Morched23MJ
Sep 01 2018 20:08
@korzo, can you be more explicit? I don't get it. :D
korzo
@korzo
Sep 01 2018 20:13
@Morched23MJ \1 is like variable, where is assigned result of first capture group
if (\d+) captures 42, \1 is 42.
@Morched23MJ It's for repeating patterns.
Does this help?
let repeatNum = "42 ss 42 ss";
let reRegex = /^(\d+)\s(\w+)\s\1\s\2$/; // Change this line
let result = reRegex.test(repeatNum);
Morchid Chellali
@Morched23MJ
Sep 01 2018 20:17
Ah now I understand. Thank you. I'll try to implement it
Got it. Thank you, @korzo. :)
korzo
@korzo
Sep 01 2018 20:25
@Lia-Sue-Kim It's aspect ratio. It applies to images, screens...
try to use image with width 2x the height.
You will see whole image on wide screens.
Then use other image and media queries for mobile screens
Pagnito
@Pagnito
Sep 01 2018 21:19
he if anone works with deck gl i made a grp https://gitter.im/DeckGL/Lobby