css-float

Centering floating list items <li> inside a div or their <ul>

时间秒杀一切 提交于 2020-01-30 21:48:49
问题 HTML: <div class="imgcontainer"> <ul> <li><img src="1.jpg" alt="" /></li> <li><img src="2.jpg" alt="" /></li> ..... </ul> </div> I'm coding a simple gallery page by creating unordered list and each list item of it contains an image. ul li { float: left; } I set the width of the container as "max-width" so I can make possible to fit the list items (images) to the browser width.. meaning that they will be re-arranged when the browser window re-sized. .imgcontainer{ max-width: 750px; } Now the

Centering floating list items <li> inside a div or their <ul>

纵饮孤独 提交于 2020-01-30 21:46:29
问题 HTML: <div class="imgcontainer"> <ul> <li><img src="1.jpg" alt="" /></li> <li><img src="2.jpg" alt="" /></li> ..... </ul> </div> I'm coding a simple gallery page by creating unordered list and each list item of it contains an image. ul li { float: left; } I set the width of the container as "max-width" so I can make possible to fit the list items (images) to the browser width.. meaning that they will be re-arranged when the browser window re-sized. .imgcontainer{ max-width: 750px; } Now the

Why the text or images are not placed behind a floating element?

半腔热情 提交于 2020-01-25 20:24:34
问题 Why the text or images are not placed behind a floating element? On this link:http://codepen.io/anon/pen/LVWmvp, you can see the example. The "blue" div is placed behind the "transp" div. But the thing is that the text (or an image) is not placed behind the "transp" div also. And please notice that the p tag is in the "blue" div. So my question is: Why does this happen? Why the text is not placed behind the "transp" div like his parent? I have been looking for an answer. But I couldnt find

Vertical alignment of float:left div's

自作多情 提交于 2020-01-24 12:34:49
问题 I have about 10 div's of equal widths but varying height and I want them to fit together as tight as possible. When set to float left they do not line up to each other vertically but instead are aligned to the bottom of the "row" above. I've mocked up a little example below and want to get rid of the white space. Do you have any suggestions. I'm limited to using this format because the content that is delivered externally. Cheers <div style="width:500px;"> <div style="display:block; width

Awkward line wrap around image

倾然丶 夕夏残阳落幕 提交于 2020-01-24 11:24:24
问题 Probably easiest to explain what I'm after with an image: When I float an image the text runs around it which is great. BUT, depending on the amount of text and the image size, I'm often left with these awkward bits. In this case the awkward text would look better in the column next to the image. I could add more bottom margin to the image depending on how much awkward text there is BUT in a responsive design the image shrinks and the text stays the same size so there is no way of doing this

Awkward line wrap around image

懵懂的女人 提交于 2020-01-24 11:24:05
问题 Probably easiest to explain what I'm after with an image: When I float an image the text runs around it which is great. BUT, depending on the amount of text and the image size, I'm often left with these awkward bits. In this case the awkward text would look better in the column next to the image. I could add more bottom margin to the image depending on how much awkward text there is BUT in a responsive design the image shrinks and the text stays the same size so there is no way of doing this

CSS float to collapse a div with wrapped text to the minimum needed

荒凉一梦 提交于 2020-01-24 07:32:07
问题 Example image: And the code at JSBIN. The situation is that I'm trying to create a list of checkboxes with labels with an 'info icon' next to each one. The idea is that if you click the label, it will trigger the checkbox (as it should) and then we fire off some actions with JS. The info icon is a tool tip that you'd click on to get more info. Because the info icon has it's own interaction, we can't stick it inline inside of the label, as the label fires off the checkbox interaction. So what

CSS float to collapse a div with wrapped text to the minimum needed

穿精又带淫゛_ 提交于 2020-01-24 07:31:44
问题 Example image: And the code at JSBIN. The situation is that I'm trying to create a list of checkboxes with labels with an 'info icon' next to each one. The idea is that if you click the label, it will trigger the checkbox (as it should) and then we fire off some actions with JS. The info icon is a tool tip that you'd click on to get more info. Because the info icon has it's own interaction, we can't stick it inline inside of the label, as the label fires off the checkbox interaction. So what

How to remove white space from different height divs and make them “suck up” to each other? [duplicate]

心已入冬 提交于 2020-01-23 18:09:00
问题 This question already has answers here : How to Create Grid/Tile View? (8 answers) Closed 2 years ago . I'm trying to make my "divs" stack up. The divs will always be different heights and they create "white space" gaps. I want to remove this white space and "butt" them up next to each other. This seems like it would be very simple, but I'm having a very hard time finding a solution! I only have one requirement for this, the HTML given in the JSfiddle cannot be edited/added to. I have to do

How to remove white space from different height divs and make them “suck up” to each other? [duplicate]

一笑奈何 提交于 2020-01-23 18:05:13
问题 This question already has answers here : How to Create Grid/Tile View? (8 answers) Closed 2 years ago . I'm trying to make my "divs" stack up. The divs will always be different heights and they create "white space" gaps. I want to remove this white space and "butt" them up next to each other. This seems like it would be very simple, but I'm having a very hard time finding a solution! I only have one requirement for this, the HTML given in the JSfiddle cannot be edited/added to. I have to do