+ 2

how to set webpage resolution that fits on all types of screens

9th Jan 2019, 1:41 PM
Wasiq Abdullah
26 Respostas
+ 3
Gordon He may have seen that used with respect to `background-size:cover`, which wouldn't be applicable to the `width` style.
12th Jan 2019, 5:41 AM
David Carroll
David Carroll - avatar
+ 5
Ch Wasiq I made some fixes to your code with notes to help. https://code.sololearn.com/WH4I2Ao4XBjo/?ref=app See Fix Notes in the HTML code. FIX Note 1: Tge span tag should not have been nested in ul tag. FIX Note 2: The closing div tag was missing.
11th Jan 2019, 11:27 PM
David Carroll
David Carroll - avatar
+ 3
Ch Wasiq I took your code, set a font size 10px on body tag, change the rest of px to em dimension, add a media query for mobile size less than 640p, with default font size changed to 6px. https://code.sololearn.com/WY37UD72pgnu/?ref=app Hopefully from the code, you could understand that a responsive website could be built by using a parent font size (in the body tag) with the rest of elements in em dimension. We just need to change parent font size for the webpage to be adjusted on different screen width using @media queries. You may need to add more @media for screen size that you want to test.
12th Jan 2019, 3:31 AM
Calviղ
Calviղ - avatar
+ 3
Beside em, rem and % can help to build better responsive website. More information https://medium.com/code-better/css-units-for-font-size-px-em-rem-79f7e592bb97
12th Jan 2019, 4:30 AM
Calviղ
Calviղ - avatar
+ 2
There are different ways CSS width:100vw; height:100vh; JS window.innerWidth ; window.innerHeight ;
9th Jan 2019, 1:49 PM
Gordon
Gordon - avatar
+ 2
David Carroll Thanksss. its really helpful but ..my ques is that why this webpage not perfectly fits on mobile screen
12th Jan 2019, 1:48 AM
Wasiq Abdullah
+ 2
Calviղ Thanks bro now i understand it
12th Jan 2019, 5:13 AM
Wasiq Abdullah
+ 2
Ch Wasiq Can I know what width : cover is?
12th Jan 2019, 5:30 AM
Gordon
Gordon - avatar
+ 2
Ch Wasiq Are you coding this page on a computer or phone? Testing your media query styles will require a screen where you can change the size of the browser window.
12th Jan 2019, 5:32 AM
David Carroll
David Carroll - avatar
+ 2
David Carroll oh I see~
12th Jan 2019, 5:42 AM
Gordon
Gordon - avatar
+ 1
vw and vh means
9th Jan 2019, 1:56 PM
Wasiq Abdullah
+ 1
okyyy helpfull
9th Jan 2019, 1:59 PM
Wasiq Abdullah
+ 1
Gordon I think you meant to type "viewport", not "viewpoint." 😉
9th Jan 2019, 2:02 PM
David Carroll
David Carroll - avatar
+ 1
viewport in css?
9th Jan 2019, 2:03 PM
Wasiq Abdullah
+ 1
i applied viewport but still webpage does not works on mobile
9th Jan 2019, 2:06 PM
Wasiq Abdullah
+ 1
Can you share your code in SoloLearn Playground?
9th Jan 2019, 2:07 PM
David Carroll
David Carroll - avatar
+ 1
plz correct me
9th Jan 2019, 2:12 PM
Wasiq Abdullah
+ 1
David Carroll oh yes they should be viewport~ I kept knowing them as viewpoint width/height wrongly, thanks for correcting me~ so good to have you at the back^^
9th Jan 2019, 2:14 PM
Gordon
Gordon - avatar
+ 1
For better responsiveness, instead of px, use dimension of em.
9th Jan 2019, 2:37 PM
Calviղ
Calviղ - avatar