How I adjust the width and height of the background image in the text box? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How I adjust the width and height of the background image in the text box?

give me example for this https://code.sololearn.com/W296BqQlscDY/?ref=app

2nd Aug 2017, 5:16 PM
Faizan Shaikh
Faizan Shaikh - avatar
3 Answers
0
background-size: width height; the width and height can be set in pixels or % 100% is the entire width or height of the element itself, in this case
2nd Aug 2017, 5:38 PM
voidneo
+ 4
okay I got it! thanks
3rd Aug 2017, 3:28 AM
Faizan Shaikh
Faizan Shaikh - avatar
+ 4
Background-size can use more (css) units than just pixels (px) and percents (%)... and provide also useful special values: background-size:cover; /* fit the image to the element size, keeping ratio and cropping if necessary */ background-size:contains; /* fit also the image to the element size, keeping ratio but without cropping (repeating or leaving empty space on side greater than the one of the image ratio, regarding of use of 'background-repeat' */ Anyway, these special values are often (but not always) used with: background-repeat:no-repeat; /* in those kind of context, repeatition is often not necessary */ background-position:center center; /* to guarant that the center of image is always visible */
3rd Aug 2017, 7:34 AM
visph
visph - avatar