fluid-layout

How to center crop an image (<img>) in fluid width container

橙三吉。 提交于 2019-11-28 13:45:15
问题 How do I get an image to stay centered when its fluid width (percentage based) container is too small to show the whole image? How can I center the image inside it's container This means it should show the middle of the image instead of the sides when container is too small. 回答1: When It Works You might have a container that holds some content such as two <div> s that are 50% wide each, sitting next to each other. For this example, we can illustrate just one child of the container: We'll name

Maintain aspect ratio of a div according to height [duplicate]

半腔热情 提交于 2019-11-28 12:19:22
This question already has an answer here: Maintain div aspect ratio according to height 4 answers I have to maintain the aspect ratio of a div with respect to the height on window resize. I can maintain the aspect ratio(x:y) with regard to the width(X%) using padding-bottom; or padding-top; . So from the analogy, I tried using padding-left; .wrapper{ height: Y%, position: relative; } .wrapper:after{ padding-left: Y(x/y)%; display:block; } But the percentage value of padding-left does not give any width to the wrapper. How can I maintain the aspect ratio of that div according to its height? As

How to set auto-margin boxes in flexible-width design using CSS?

喜夏-厌秋 提交于 2019-11-28 12:01:52
I have DIV with flexible width set e.g. min-width:800px and max-width:1400px. In this DIV, there are many boxes with fix width 200px and display:inline-block. So depending on parent DIV width, these boxes fill the entire space. My problem is the blank space on the right side which is caused by variable width of the parent div. Sometimes this blank space is small and looks fine, but with different widths of the parent div, this blank space is almost 200px. I don't know, if I described my problem in enough detail, I hope this picture will help to describe my actual situation: And this is what I

CSS 3 Column Liquid Layout Dynamic Same Height Column

丶灬走出姿态 提交于 2019-11-28 11:32:34
问题 I am wondering how to make a liquid(15%,70%,15%) 3 column css layout have dynamic equal height columns where each column matches the height of the longest column dynamically(in other words: according to content in each column, if column 1 is longer than 2 and 3, then columns 2 and 3 should automatically be the same height as column 1) Is there a way to accomplish this, I have looked at the holy grail: http://alistapart.com/article/holygrail and it says that it does not work with equal height

CSS columns bug — 5 column count only showing 4 (with images)

我的梦境 提交于 2019-11-28 11:31:06
I am trying to implement Chris Coyier's example of using CSS columns to create a seamless responsive grid of images. I put Chris's files onto my server and everything looked fine. The only thing I changed was the actual images. Now, as you see on my test page , there are only 4 columns of images instead of the specified 5, using column-count:5; . The fifth column is just whitespace with no content. This only happens when the browser window is greater than 1200px. When the browser window is less than 1200px, the media queries kick in and decreases the column count 4, 3, 2, and finally 1. In

CSS fluid layout: margin-top based on percentage grows when container width increases [duplicate]

回眸只為那壹抹淺笑 提交于 2019-11-28 08:55:00
This question already has an answer here: How to set the margin or padding as percentage of height of parent container? 8 answers I'm just learning CSS fluid layouts & responsive design, and I'm trying to use all percentage values with no px values in a layout. So far it seems to be working, but in one spot, I'm seeing something I didn't expect. I'm trying to put a margin between two vertically stacked divs that changes based on the height of the container. I'd expect that margin to change when I resize the window vertically, but it also grows if you resize it horizontally, which I don't want.

For a fluid Navigation Menu, how to adjust padding dynamically for each Breadcrumb?

旧城冷巷雨未停 提交于 2019-11-28 06:27:16
问题 I am currently building a site with a fluid layout. None of the mainstream fluid templates out there actually come with a stock horizontal navigation that can adjust itself as the window is resized or loads at different widths. I've been pouring through online tutorials and other Stack Overflow solutions that try to tackle similar problems, some are extremely clever and come really close but none are able to handle a block-like hover effect a {display:block; padding:10px 40px;} a:hover

CSS side by side div with Pixel and Percent widths

*爱你&永不变心* 提交于 2019-11-28 06:26:10
I have two div's (side by side) inside a parent div, i want right div to occupy 100% of remaining space (i.e. 100% - 200px) and should always stay next to left div (not below left div): <div id="wrapper" style="width: 100%;"> <div id="left" style="background-color: Blue; height: 100px; float: left; width: 200px;"></div> <div id="right" style="background-color: Aqua; height: 100px; float: left; width: 100%;"></div> <div style="clear: both;"></div> </div> Since you have only one fixed width column, float it left and that is it. As for the second column, do not specify float and width; this makes

Center DIV content Fluid Vertical and Horizontal

亡梦爱人 提交于 2019-11-28 05:44:07
问题 This is the example I have: Line height does not apply to fluid divs. The code I have is currently based on line-height but the the sizes of the boxes change. So how can I have a link (content) always in the exact middle? I want to make sure that the content inside this DIV is always going to be equally centered from the top and the sides. Vertical and Horizontal centered. Current code: (note style tag is blank as this is dynamic filled) <style type="text/css"> .box{ width:468px; /* php

CSS Div width percentage and padding without breaking layout

♀尐吖头ヾ 提交于 2019-11-28 03:32:53
There may be a simple fix for this, but it has troubled me for ages now... Let me explain the situation. I have a div with the ID 'container' that holds all the contents in the page (including header and footer also) that will keep everything inline and I can do just 1 simple 'margin:0 auto;' instead of multiples. So lets say that I have the width of #container set to 80%. Now if I put another div inside with the same width (80%) and give it the ID of 'header' with 10px of padding all around, the layout would "break" (so to speak) because the page adds the padding amount onto the width. So,