Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have an image in my site which it's height is bigger than it's width.
The problem is that in small screens the image is very tall and I want to limit it somehow and set the max-height to be the height of the screen (responsive).
I'm using Bootstrap so I used .img-responsive class but it doesn't work.
Here is an example: http://jsfiddle.net/dqsLt4sa/1/
Thanks.
You can use the vh unit for that.
max-height: 100vh;
To specify that no image should be larger than the screen use the following CSS
img {
max-height: 100vh;
max-width: 100vw;
}
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I need some help here. My final project is due tomorrow and the mobile responsive view of the app is completely off. I don't know how else to explain it other than just giving you the link to the URL.
https://venpresath.github.io/FinalProject/#!/home
It appears that the animation that I put onto the spinning record is making the width of the screen larger than the background is.
I tried overflow: Hidden; but it didn't correct the issue.
One work around is to hide the overflow of the record, something like:
.homeContent{
overflow-x: hidden;
position: relative;
}
Try placing overflow: hidden; directly on the body tag, this should ensure that whatever happens in the content the body shouldn't scroll horizontally.
you can use transform scale and transform origin css. please add below css. this is the demo http://recordit.co/UK63B2vKiR
.homeContent{transform: scale(.8, .8);}
body{background: darkslateblue!Important; overflow-x: hidden;}
*{max-width:100vw;}
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
On this website I would like to fit the picture for the entire div width.
(If you scroll down you'll see the blog section)
As you can see from the picture there are some white space on left and right.
How can I achieve this?
Note: I can't edit the HTML structure of the website. I can only work via CSS or JS.
Many many thanks
You only have a max-width: 100%- So if you set width: 100% it'll work, like so:
img.scale-with-grid, #Content img {
max-width: 100%;
height: auto;
width: 100%;
}
As can be seen here (updated css in chrome devtools.)
Just give img.scale-with-grid, #Content img : width:100%
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.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I am very aware of ´background-size:cover;´ etc, but this case is different. There is something that defines the height of the HTML / BODY in this page - and I can not fathom what it is.
I have tried everything I know and remember for the past 2 hours, but somehow the background will not cover. It seems to be due to the body adjusting the height to some formula instead of the real size of the screen.
I see it best when my screen is about 1300px wide.
Can you see what causes the problem?
Now I just enter some few lines of code.
The image was NOT covering the full screen. The solution was to add the answer below in the CSS:
body, html {height:100%}
That fixed it all.
add height: 100vh; to this rule :
body>.multibg {
height: 100vh;
}
this will solve the issue i'm pretty sure !!
Viewport units: vw, vh, vmin, vmax - CR Length units representing 1%
of the viewport size for viewport width (vw), height (vh), the smaller
of the two (vmin), or the larger of the two (vmax).
browsers compatibility for Viewport units
Please add height: 100% on body and html
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
Currently on our company website, there is no max width set. Therefore, no matter the size of the screen you're looking at it on, it will try and extend to that width. I would like to change that so it stops expanding at a certain max width -- say 1600 pixels wide.
I hope that someone can assist me with this code.
http://visualicreative.com/industries/non-profit/
You can try adding this line in responsive.css (last line):
#page, #main { width: auto; max-width: 1600px; margin: 0 auto;}
It will basically set a max-width and center the #main and #page element.
Seeing the code on your website, I'm not sure that will set a max-width to all your website. It's a really choatic piece of code.