+ 4

Responsive Design: Background Image

Beginner here. Why is this background image not behaving in a responsive manner? It spans off-screen on my small device. I appreciate any help. Thank you. https://code.sololearn.com/WvVJ0aO22FTE/?ref=app

12th Jan 2022, 1:30 AM
TahitišŸŒCastillo
TahitišŸŒCastillo - avatar
22 Antworten
+ 7
font-size:25px;
12th Jan 2022, 2:36 AM
Simba
Simba - avatar
+ 7
TahitišŸ·Castillo note: using br tag is not a standard way
13th Jan 2022, 3:02 AM
Kelvin Paul
Kelvin Paul - avatar
+ 5
Please avoid margin left top .... as percentage if it's not necessary. Please learn flex and grid to center your web layouts https://code.sololearn.com/W3yzqmyoMaHK/?ref=app
12th Jan 2022, 2:55 AM
Kelvin Paul
Kelvin Paul - avatar
+ 5
TahitišŸ·Castillo i didn't mean you should use media queries in This code It was just a general suggestion seeing you somewhat confused in responsive design Coming to your second question about opacity I suggest you not to use that in body because there is no background opacity in Css yet i can get the idea what you want you can create a wrap div element and style it that just like you did for body (just little bit size changes) or by using pseduo css elements May these can help you https://css-tricks.com/snippets/css/transparent-background-images/ https://www.freecodecamp.org/news/transparent-background-image-opacity-in-css-and-html/ https://www.digitalocean.com/community/tutorials/how-to-change-a-css-background-images-opacity
12th Jan 2022, 3:44 AM
Atul
Atul - avatar
+ 5
TahitišŸ·Castillo Yeah i edited my prev answer code i think you want this effect i used blur for it because it looks better than opacity you can use anything :) https://code.sololearn.com/WsgD714HL6E4/?ref=app
12th Jan 2022, 4:08 AM
Atul
Atul - avatar
+ 5
Wrap your text inside of a block element. Like div, section. <footer> <section class="thought-by">Alan Paton</section> <section class="year">...</section> </footer> ā˜ŗļø
13th Jan 2022, 3:26 AM
Kelvin Paul
Kelvin Paul - avatar
+ 4
Simba Thank you, Sir. I canā€™t believe that changing the font size affected the background.
12th Jan 2022, 3:08 AM
TahitišŸŒCastillo
TahitišŸŒCastillo - avatar
+ 4
TahitišŸ·Castillo I added a few things like meta shrink-to-fit and adjusted the filter blur and separated the lines with a double break .. I'm sure there are a few more suggestions. I also transparent the blockquote and added a footer as Kelvin Paul drew my attention to. https://code.sololearn.com/WAyvQLUabfUh/?ref=app
13th Jan 2022, 4:19 AM
BroFar
BroFar - avatar
+ 4
https://code.sololearn.com/WSLZPpBIFgr7/?ref=app
7th Apr 2023, 10:34 AM
JaScript
JaScript - avatar
+ 3
Solomoni Railoa Thank you. Only for the sake of accessibility, I wanted the font somewhat large. It looks better smaller (somewhat), and when I reduced it to 25px (Simbaā€™s suggestion), my problem was solved. Problem: the background image was not showing fully on the small screen. I do not want the image to repeat. I learned via W3Schools and elsewhere that background-size: cover will enable the background image to cover the entire page responsively, but it didnā€™t do so when my font was 50px. I donā€™t understand how, but reducing the font size worked.
12th Jan 2022, 3:20 AM
TahitišŸŒCastillo
TahitišŸŒCastillo - avatar
+ 3
And now thereā€™s a new obstacle. Where do I put my opacity: styling so that the background becomes maybe 50% transparent? I tried various ways, but it only caused the text to disappear. Simba Solomoni Railoa Kelvin Paul
12th Jan 2022, 3:29 AM
TahitišŸŒCastillo
TahitišŸŒCastillo - avatar
+ 3
TahitišŸ·Castillo If you don't your image to repeat and don't want to strech it i think this should resolve the problem https://code.sololearn.com/WsgD714HL6E4/?ref=app I suggest to learn about media queries in CSS Also Kelvin Paul said try to learn Flex and grid they make things easier :)
12th Jan 2022, 3:31 AM
Atul
Atul - avatar
+ 3
Atul Believe it or not, I actually thought about adding a media query or two, but I thought the background-size: cover should be sufficient. Thank you. Edit: Wow, that looks much better. Thank you.
12th Jan 2022, 3:33 AM
TahitišŸŒCastillo
TahitišŸŒCastillo - avatar
+ 3
Wow, thatā€™s nice Atul . Iā€™ve been sitting here trying to get the pseudo div aligned just right. Iā€™m almost there, but Iā€™m going to try the blur. Thanks a million!
12th Jan 2022, 4:11 AM
TahitišŸŒCastillo
TahitišŸŒCastillo - avatar
+ 3
Kelvin Paul Thank you for the footer, div, section info! I used it. With each tip, the design process becomes more comprehensible.
13th Jan 2022, 10:51 PM
TahitišŸŒCastillo
TahitišŸŒCastillo - avatar
+ 2
Thank you Kelvin Paul . I will study flexbox and grid more.
12th Jan 2022, 3:30 AM
TahitišŸŒCastillo
TahitišŸŒCastillo - avatar
12th Jan 2022, 2:29 PM
IMAN
IMAN - avatar
+ 2
Thanks for that tip Kode Krasher ! I will gladly try that. Edit: I agree 100%. Thanks again!
13th Jan 2022, 1:32 AM
TahitišŸŒCastillo
TahitišŸŒCastillo - avatar
+ 2
Kelvin Paul Just using what I have in my developing toolbox. Justifying the text didnā€™t work, and I know no other way to get the line breaks.
13th Jan 2022, 3:19 AM
TahitišŸŒCastillo
TahitišŸŒCastillo - avatar
+ 2
BroFar Thank you! This is fascinating how many different modifications can be made. I think your modifications give the image some depth. I also really like the line breaks! Thanks for the tips.
13th Jan 2022, 10:49 PM
TahitišŸŒCastillo
TahitišŸŒCastillo - avatar