so i have this simple problem with Bootstrap but i have not found a solution to it and it goes like this: i want to have a carousel in my web page and i took the code from Bootstrap's official web page and i want to display 1200 x 400 images but if an image i want to display is not that size, it could be smaller or it could be bigger, what should i do to make that image fit on the space if it's not the size i want... i have tried with html specifying a width and a height but it doesn't work. Maybe this question is a little bit silly but i have not found a way and also i have tried to change the size of the image but it was unsuccesfull.
Thanks for the answers!
It is often recommended for slider to keep all your images same dimension. But if there is no way left to do so, you can make CSS adjustments.
For an example:
You can give same dimensions (height and width) in CSS for all those images. and use object-fit: cover; so that image does not squeeze.
Related
I'm working on a website. There's one problem. The slider won't fit in the frame without stretching.
Slider Image is full width of screen and i have defined height for it.
In CSS part i have applied object-fit: cover but this crop my image
I hope you guys can help me out on this. I'd tried alot and also asked some other people but they can't help me with this.
Or Should i restrict my client to use image of that resolution only?
Yes Mostly you should restrict the client from using different ratios, or resolutions, because you are using the full width aaaaand defined height, defined height is very limiting in your case, what you can do is use
object-fit:cover;
object-fit:center;
but that doesn't stop the cropping it will just focus on the center of the image when cropping.
I have a site that still uses Drupal 7.x. I have a top banner that works fine on a large screen with greater than 1100px. However, that same banner will not work on smaller screens, especially not on smartphone size displays. So, if I put the banner into a block with an image tag, how can I change the source image for different display widths?
I tried using a percent width and media queries for the different background images. I haven't found a way to style the background image so that it resizes as a percent of the viewport. It will change the background image based on the media queries but I cannot get the alignment or the percent width of the background image to change with the change in the width of the viewport.
Thanks in advance for any advice on how to manage this issue. Maybe there is a module that handles changing the content of a block based on the size of the viewport.
If the banner doesn't fit on your smaller screen, try using background-size: contain or background-size: cover.
It should be possible to archieve this using CSS only, without the need to have different images in all media queries.
Before anything, I won't provide any of my code because I don't want to use it anymore, i'd rather start fresh with some new ideas
I have to make a div that has a navbar and a background-image in CSS, resize with every resolution, I tried using VW and VH, but whenever I tried resolutions like 1280x1024 and 1024x768, the image would keep it's ratio but would only fill the page width wise, as if there was some margin or padding on top and bottom...showing that the vw and vh were not working.
So my question is, what is the best way to resize a so that the background will always fill the page, even if some of the image is cutout.
Here's an example of a website I found that works exactly the way I had in mind.
http://bigdropinc.com/
Thank you in advance
In CSS use
background-size:cover;
I am fairly new to html/css and I am coding a website for my mom. (Live example here: http://jleblanc.pancakeapps.com/index.html) and for the life of me I can't make the photos any smaller. Do you guys have any ideas?
If images are set in following format:
<div id="PlaceHolder"><img src="source.jpg"/></div>
You can add rule in CSS:
#PlaceHolder img{
width: 400px;
}
If you set height or width - it will automatically resize image maintaining it's aspect ratio.
Assuming you're talking about the oversize background images in your colored tabs, the problem is that you have background-size: contain set which is scaling the image to the container size. Choose another background size (background-size: (x)% (y)% maybe?
(You'll get better answers if you reduce your question down to the specifics of what you're trying to do and give example code of what's not working, rather than just linking to a website and asking what's wrong with it)
You can set image as responsive by making them size to 100% so they can fit any size.thanks
I am trying the carousel example here http://getbootstrap.com/javascript/#carousel with image of 1200x300. It looks fine in large screen with width more than 1200. However when I reduce the browser width the image in the carousel decrease and it looks thin.
Is there any trick to have kind of minimum height applied to the image within carousel.
You can use CSS media queries to achieve what you need.
Basically what I think is happening as I don't have any code to look at is that you have responsive bootstrap on which you need to turn off otherwise bootstrap cleverly resizes the objects on the page.
Also I noticed that if you resize the image http://placehold.it/1200x300 then it shrinks though that might not affect it at all
If you set max-width: 100%; height: auto; on the img, it will retain it's aspect ratio (i.e. remain the correct shape) no matter how narrow you make it.