The Low Down - Why the Useful Portion of the Page Isn't Maximized
https://www.dukelearntoprogram.com/course2/doc/javadoc/index.html?course=2
Go there and, if you have OCD like me, you ask this question :
And the response
(takeaways : CTRL-SHIFT-C to point and select an element. And you get the element.style {} standing by to let you tweak it! Also, height:75vh; in CSS gives you 75% of the viewport. Thank you Upwork.
How to open Chrome dev. Tool :- CTRL-SHIFT-C
How to tweak CSS and change CSS of the page ?
● In the dev tool in the Elements window there is a tab (or section ) named Styles.
● You can add new css rules and remove the old rules i this section
(NOTE: these changes are temporary and will be removed after the page is reloaded)
How to target the section whose style you want to change?
● There is a small arrow key in the top left of the dev. tool.
● Select that tool or just press CTRL-SHIFT-C again.
● Now hover over to the section you want to modify and click on it.
● Make sure to select the outermost container of the part whom you want to change
○ For example, her,e I targeted the whole footer as I want the whole footer to be at bottom.
How to modify styles?
● You can add new CSS rules in element.style window. Just click in the section and new line will appear to add new CSS rules
● Placing footer to stick at bottom:-
○ If you have prior knowledge of CSS then you can implement the design yourself.
○ Otherwise the best way is to Google (css to make footer stick to bottom)
○ However i am pasting the code here (Copy paste it)
position: fixed;
left: 0;
bottom: 0;
width: 100%;
● Increasing height of the content in the middle:-
○ Press CTRL+SHIFT+C again.
○ Hover and click somewhere to the container that have the readable content.
○ In element.style section add the height that suits your monitor here i am going to use
height: 650px; ← you can copy paste it and play around with the value that suits your monitor
The problem
The developer has employed a suboptimal approach in writing CSS, resulting in an unresponsive webpage. Specifically, the developer has assigned a fixed height value to the container, making it incapable of accommodating varying screen sizes, including both mobile and larger monitors.
How to avoid this kind of problem:-
Using relative units for sizing such as percentage, em, or rem. This allows the container to scale proportionally with the size of the screen, ensuring that the content remains visible and accessible on all devices.
Using media queries which allow to specify different CSS styles for different screen sizes.
Using CSS grid and flexbox that allow developers to create flexible and responsive designs. By using these tools, we can create dynamic layouts that adapt to different screen sizes and device types, making it easier to ensure that content remains accessible on all devices.
Comments
Post a Comment