Should we use max-width 100% to all images in a website? [closed] - css

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
If I set img {max-width: 100%) to make a default responsive feature to all images in a website. Is it a good practice? Should I do that?

Yes, it is a good practice but only if you implement it properly through inheritance and proper CSS naming to avoid convoluted HTML and CSS.
Having a default max-width:100% for images is a good thing as it set a standard for your website that no images should be larger than the window or the container in which it resides unless specified.
This way, you can give exceptions to specific images that should be allowed a size larger than the window or for different screen sizes using size specific rules.

It is better to make use of width and max-width. If the width of the image exceeds max-width, it will be constrained to the max value.
For example, consider the below CSS
img { width: 100%; max-width: 512px; }
If the width of the image exceeds more than 512px, then the image width is restriacted to 512px.

Related

How to make window resize not take any change [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have a question:
How to make a responsive design that when I resize the window the design not change at all(width, height, positions), only the window cover the design/content.
For example this website: https://www.zap.co.il/
How can I dot it if all elements are viewports and almost every element positioned absolutely to the body tag ?
For the viewports I can use SVG - It solving it, but the position ?
I want everything remain the same, thank for your help
this should make your page basically responsive
then for resizing components at different widths
`<meta charset="utf-8">` html code
#media screen and (min-width:800px){
//css code for screen widths above 800pixels
}
css code

What is best practice for fluid designs - using css sprites or inline images? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am working on a web site which is supposed to have a fluid layout. I am currently presented with a dilemma: shall I use css sprite or opt for inline images?
All images will need to be fluid and reduce/enlarge their size on each respective screen size. I was thinking to use CSS sprite image but that would mean that I need to identify all major screen widths and then slice all images with those respective widths and add them to my sprite...
My questions is: what is the best approach for rendering images in fluid / responsive designs? Sprites, inline images or combination of both?
Thank you!
Personally I think sprites are a little unnecessary, the internet is fast enough now to just use separate bg images. Displaying the correct image by using media queries and constraining the size in fluid designs by using background-size: cover; or contain.

Which unit should be used in web design [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am trying to design new website but I have some problems. I am using 13inch laptop when I look at the site in my computers browser everything is fine but when I look at the bigger screen div's are shown smaller etc. Which units should I use for div's width, height and the margins ? I have already try px em and know I have made it something like this.
.tBackground{
margin-left:10%;
margin-top: -200px;
margin-bottom:auto;
margin-right:auto;
height: 30%;
width: 110%;
background: rgba(80, 78, 78, 0.75);
overflow:auto;
}
with this css it is normal at bigger screen but in my 13inch laptop it is very big it doesn't fit the screen
There's not simply one unit to be used in web design. The reason that they're all there is for variation. It entirely depends on what you want:
px - Does not scale down for mobile devices
em - Does scale down for mobile devices
percent - Takes up a set amount of the screen
It depends entirely on what is trying to be accomplished. However, these are just basic differences. If you would like to read more about them, you can visit this website (which also includes pt).
Also, you can read the answers to this StackOverflow question: Why em instead of px?

Image too wide for viewport in responsive flexbox website [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am planning to redesign my site using the Flexible Box Layout Module to make it responsive since it seems to be the winning layout method for responsive sites.
But what happens if an image in one of the boxes are wider than the viewport? Can I automatically scale down the size of the image if the image is too wide for the viewport?
I haven't been able to find solid info on this topic. This may be a basic or bad question, I am not sure.
Yes, as following:
img {
max-width: 100%;
height: auto;
width: auto\9; /* ie8 */
}
(although I'm not sure if necessary, since mobile devices scale down images themselves)

Non-responsive site will not resize to fit mobile browsers [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I'm trying to take a template that was designed to be responsive and make it "unresponsive."
http://myhurlburt.com/NEW/bowling.php
The width of the page is set to 960px. When I view it on an iPad or iPhone, you have to scroll to the side to see the entire page. Do you know what in my CSS is causing that? I would like the entire site to "fit" into a browser so the user does not have to scroll to the side.
It's a big job to change an unresponsive site to a responsive one.
But you could try something like this to get started.. .wraper currently has it's width set to 960px.
.wraper{
width:100%;
max-width:960px;
}
use % for width, height and other margins. Use media queries also. If not, do zoom:1(2,3 or something);
Start by scaling the website with min/max widths and additionally use percentages instead of px.

Resources