0

Hi :How to reduce the excess distance between the image and the background ;

https://code.sololearn.com/Wa1gm0HsbR4o/?ref=app

7th Jul 2023, 12:41 PM
Let Me Know
Let Me Know - avatar
18 Réponses
+ 2
Check the css-properties: They start with small letters, not with capital letter.
7th Jul 2023, 12:44 PM
Lisa
Lisa - avatar
+ 2
0px instead of -10px
7th Jul 2023, 1:04 PM
Lisa
Lisa - avatar
+ 2
Hi Agram Person Each web browser has its own set of default styles that it applies to web pages. As a result, websites may look slightly different when viewed in different browsers. CSS Reset is a technique used to avoid these differences and make web pages appear more consistent across browsers. For example, Bob_Li provides a simple example of a CSS Reset that you can use. In CSS, the asterisk (*) is like a magic wand that applies a style to every element on a web page, ensuring that no element is left out. However, one drawback is that you will need to manually edit every new element you include in your project. Which will lead to more code writing.
8th Jul 2023, 4:12 PM
Chris Coder
Chris Coder - avatar
+ 2
Agram Person some issues I noticed in your card is that depending on your screen size, since the width of your div is 108%, the background appears to run off the right side. Changing the width to 100% will correct that issue. The second issue is with your margins. Simply removing them will reset to default values. Lastly, regarding your "align-items center" property, since you included that only, the browser will try to automatically align items to adjust to the various screen sizes. So simply removing that property will get rid of the unwanted gaps between the picture and the background. https://code.sololearn.com/Wk64Og4b4Ce6/?ref=app
8th Jul 2023, 4:13 PM
Chris Coder
Chris Coder - avatar
+ 1
Thanks for the note
7th Jul 2023, 12:48 PM
Let Me Know
Let Me Know - avatar
+ 1
Check line 16: you don't need a top-margin
7th Jul 2023, 12:57 PM
Lisa
Lisa - avatar
+ 1
Bob_Li min-height:200px; is good idea
8th Jul 2023, 9:01 PM
Let Me Know
Let Me Know - avatar
+ 1
Bob_Li andChris Coder I liked your suggestions.and I wish you success in your projects
8th Jul 2023, 9:11 PM
Let Me Know
Let Me Know - avatar
0
But there's a margin above the picture.
7th Jul 2023, 1:03 PM
Let Me Know
Let Me Know - avatar
0
Yes. How to reduce the distance between images and 'li' without project collapse
8th Jul 2023, 1:18 PM
Let Me Know
Let Me Know - avatar
0
Or in another way, how can I evolve part of the code without affecting the rest?
8th Jul 2023, 1:19 PM
Let Me Know
Let Me Know - avatar
0
Agram Person What i usually do is apply a global reset *{ padding:0; margin:0; box-sizing: border-box; } then add in the required margins and paddings later on Compartmentalize your code into sections of divs. One big container div for nesting everything. Smaller sub sections for more fine grained arrangement.
8th Jul 2023, 1:21 PM
Bob_Li
Bob_Li - avatar
0
*{ } Is it the one that gives you better control over the code?
8th Jul 2023, 1:26 PM
Let Me Know
Let Me Know - avatar
0
It works for me, since paddings and margins are 0 and not some unknown default value. study my code to see how things are nudged into place.
8th Jul 2023, 1:29 PM
Bob_Li
Bob_Li - avatar
0
Agram Person even simpler if you use the image as a background image. https://code.sololearn.com/WzwreuyCQSZh/?ref=app
8th Jul 2023, 5:42 PM
Bob_Li
Bob_Li - avatar
0
As per my observation you just need 2 things to configure in your css. First apply on the body a 0 padding and box-sizing in border-box. Then remove the margin-left in your img class or make it to 0 value.
9th Jul 2023, 4:23 AM
Robert
Robert - avatar
0
You can use the background-position in the CSS style to reduce the size of the image
9th Jul 2023, 8:12 AM
Cisco AI
Cisco AI - avatar