spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Responsive Centered Image: Vertical Resizing - NOT


The tricky part with these scenarios is that your maximum width and height has to be dynamic, in the sense that they can readily adapt to different viewport orientations. If crossbrowser compatibility is not a major concern, you can use vmax and vmin units respectively for your image maximum dimension measurements, so to force the image to obey the viewport boundaries regardless of viewport orientation.

This trick only works if:

  • Browser support for viewport units are available — you might have to consider fallbacks for those who don't
  • That the #lightbox container has dimensions (both vertical and horizontal) relative to the viewport size.

#lightbox{
    background: lightblue;
    padding: 0px;
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%; 
}

#slide{
    background: #ffdb4c;
    /* height: 300px; */
    position: relative;
    top: 50%;
    
    -webkit-transform: translateY(-50%);
    -moz-transform:    translateY(-50%);
    -ms-transform:     translateY(-50%);
    -o-transform:      translateY(-50%);
    transform:         translateY(-50%);
}

img {
    max-width: 80vmax;
    max-height: 80vmin;
    display: block;
    margin: auto;
}
<div
id="lightbox">
    <div id="slide"><img
src="http://lorempixel.com/800/600/"
id="myImg"/></div>
</div>


Categories : CSS

Related to : Responsive Centered Image: Vertical Resizing - NOT
wx.BoxSizer both VERTICAL and HORIZONTAL centered
Here is a simple example: import wx class Frame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, "Vertical center") self.text = wx.StaticText(self, label=("This should be centered both" " vertically and horizontally")) sizer_v = wx.BoxSizer(wx.VERTICAL) sizer_h = wx.BoxSizer(wx.HORIZONTAL) sizer_h.Add(

Categories : Python
Keep image beside h1, both centered regardless of screen-size
Make the h1 and img display: inline-block and remove the floats. They will both be centered by the existing text-align: center on the div. Also, set them both as vertical-align: middle, as the default baseline value may cause unexpected behaviour with additional elements. At the moment, the wrapping div should have an appropriate min-width so it does not get too small and cause the line to be br

Categories : HTML
Resize Responsive image without stretch + zoom effect on image link
I can complete the background-image: cover. Create a html tag with a id of 'cover' like so... <div id="cover"> <!-- content --> </div> Then, you need to do the following in CSS. #cover { padding: 0, 0, 0, 0; background: url(http://placehold.it/300x150) top left no-repeat; background-size: cover; height: 300px; } I would imagine to do the zoom effect, yo

Categories : CSS
CSS: How to center text over an image, both always centered and proportional regardless of window size
Try googling css media queries. Here is a link to a good page. Adjust the width/height of the image based on the screen size. Here is a link to a reference: w3c media queries.

Categories : CSS
Resizing image in Django using sorl-thumbnail
You can use sorl-thumbnail in your view to resize an image like: from sorl.thumbnail import get_thumbnail im = get_thumbnail(your_image, '100x100', crop='center', quality=99) # ... ... ... ... ... ... ... ... ... # Do whatever you want to do with this new resized image # e.g.: Send the url of the image to template # e.g.: return HttpResponse('your_template.html', { 'image

Categories : Jquery
Recently Add
Ignore CSS declaration on a specific control
Mark space for :after content non-breaking
2 inline images - 1 centered and 1 right using Bootstrap
Bootstrap - three sibling col divs, is this layout possible?
jquery mobile-vertically center two lines of button text
Change footer content in magento
CSS help - Shopify Blockshop theme collection page alt image hover changes
SVG filter feGaussianBlur in percentage
How to remove arrow from select element
how to align sub tags in parent tag
Attribute name "onclick" associated with an element type "Label" must be followed by the ' = ' character
CSS : Fixing up/down arrow CSS
Flip horizontally only one background image
Recent posts in footer widget not aligning
Change fielderror style for a specific form only
Creating disable opacity bootstrap 3?
How to display two nav bars in bootstrap while browsing through mobile and displaying content on it without use of button that bootstrap provides
Why css & image get distorted on URL rewrite in asp.net?
changing css class variables
CSS Scrolling Background Image
Custom Checkbox Not Working in Chrome on Windows
Facebook like box showing only partially
Gulp sass output paths for css.map files Google Chrome can't resolve path
background-image not displaying
Undefined variable in SASS, even though the variable is defined above
css - start new line when we reach width
How to create a horizontal calendar with nested lists?
See current column category used in Bootstrap 3
CSS3: How do I make a linear gradient on top of an image suitable for cross browser compatibility?
Responsive Centered Image: Vertical Resizing - NOT
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.