CSS: How to align differently sized images in a line? - css

I am trying to align differently sized images in a line using the vertical-align property as well as by keeping top:50%
Now it does solve the problem partially as all the images are vertically in the middle but due to the different sizes of the images they are not aligned "like pearls on a string"
I want to somehow make images go top:50% from the centre of the image not it's border.

my simple example which uses jquery
http://jsbin.com/ekazo3

Related

Bootstrap - change table layout on mobile

So on desktop I want 4 columns with an image above the text like the first image (so col-3), very easy. (I have the image and text in the same col)
but on mobile I want the icon appear on the left and the text on the right as per the second image.
i have tried floating the image lleft and the text right but that doesnt work I tried splitting the image and the text but they won't line up properly on all screen sizes if i do.
This feels like it should be so easy but my brain is stuck.
You can try using Flex instead of floating divs for the div that contains col class
See here an example - https://playcode.io/995433 (Try to resize the playground viewport to see the mobile layout). I hope this is what you need. I've used BS inline classes for convenience.
Bootstrap align div horizontal to vertical on responsive There is your reference

CSS table not align images properly

I'm using CSS table to create a responsive layout and to align images horizontally. All the images will resize horizontally when I resize the screen size.
But the problem is the image on the right hand side will never align itself, if you take a look at my pen:
http://codepen.io/vincentccw/full/IlHfj/
Clearly you can still see the a very thin red line on the top right image, what made it even worst is if I resize them slowly, the whole image start to wobble.
Is there a workaround for this?
Your images are not lining up because even though you have given the cells the same width, due to the way tables are rendered (and the number of decimal places you have used) your right cell is slightly thinner than your left cell making that image slightly shorter (resulting in the red line)
You can either add vertical-align:top to your cells (to stop the wobble) or make sure that the left and right cells are going to be the same width by removing the width for the middle column: http://codepen.io/anon/pen/pzrvc

Best way to position over image

I got a navigation menu as image. I made a nav div with the image as background and a fixed width and height. Now in the little boxes under the lines I want nav links. So what I did is I made multiple divs in the nav div and positioned them in the little boxes. So they are all positioned perfectly inside firefox but, unfortunately in other browsers like chrome they have different positions (nothing extreme, but they arent perfectly aligned in the little boxes).
What I thought was that whenever you have a certain fixed height and width of the container div. The margins of the child divs will be the same on all browsers and screen sizes as they will always be the same size. How is this possible and what would be the best options to make this nav menu possible?
Try use this http://www.image-maps.com/ ... image maping tool lets you to set link coordinates.
If you know where these boxes are located pixel-wise in the background image, you could absolute position the nav divs and get them precisely where you want using top and left based on pixels of the parent div (with the image) instead of using margins.

CSS center cropped image of variable dimensions

I am trying to display a cropped center area of an image and have it work for different size images.
I had success setting a fixed width for the div containing the image and using overflow:hidden property, this works the way I'd like it to except this only shows the leftmost part of the image and the right side is hidden.
What I'd like is to display the center part of the image and have the left and right sides of the image hidden.
I'd go with the approach of making it a background image
.imghider {width:100px; background-image:url(./qed.jpg); background-position:center center;background-repeat:no-repeat;}
<div class="imghider"> </div>
As for different sizes you could use several classes or CSS expressions (or server side css generation)
I hope this helps.

CSS setting with on a div which contains a background

I have this website.
The div container contains a background with a grungy look, and the body contains another background that is repeated on the x coordinate.
If you view the site you'll see whitespace on the left and right side. I am wondering how I can set the background images to expand based on the screen resolution. Would it work to set a width based on percentage for each div?
To my knowledge, CSS does not support scaling background images, which is disappointing to say the least. Long story short, you'll probably have to fake it with a fixed-position, z-indexed img tag. That, or what you did: a large image with a background-repeat.
I dont see any issues with what you've got in FF3/IE6/IE7 and chrome. only issue i see is the transparent png in ie6 with the ugly gray behind it.
ie6 I gotta fix but what the customer wants is for the with of the page to size up based on the users computer resolution
Unfortunately, you can't scale the image itself.
What you could do would be remake the div structure so that the inner div contains the center of the grungy background and the sides were tiled through two separate divs. You could then recut the center piece to tile both vertically and horizontally and give it a width that is a percentage of the window size. You could keep it from getting too small via javascript.
This is not an optimal solution, but if the client is set on having it scale with the browser window, this might accomplish it for them.
thanks for all your answers, when i said white space i didnt mean actual white space what i was refering to was that the entire container div wasnt sizing (width wise) towards what the users computer resolution was. and since allot of the divs are set with a background image there is no css code for setting the width on the image but i guess it would work on the divs. but thankfully after talking with the customer he changed his mind and doesnt want it anymore :)

Resources