English 中文(简体)
如何利用诱杀装置横向调和图像,以便其表层和底线相同?
原标题:How to use Bootstrap to align images horizontally so that their tops and bottoms are on the same horizontal line?
  • 时间:2023-10-11 02:27:58
  •  标签:
  • css
问题回答

这是100%的宽度、反应性和非波束装置解决办法。 它很简单,没有诱杀装置,因此使其比需要更加复杂?

你们的样本形象问题在于,如果图像之间存在差距,数学就不会奏效。 你们是否想要把一、二行之间的差距描绘成一个小数10 000帕左右的人? 或者,你是否希望底部的广度形象略低于500px? 两者都是可能的。

I went with the first option, having the tall image be a little taller. So I have placed it inside a container which then allows me to use object-fit: cover;.

body {
  margin: 20px;
}
.layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.layout>*:nth-child(3) {
  grid-row: 2;
  grid-column: 1 / span 2;
}

.layout>*:nth-child(4) {
  grid-row: 1 / span 2;
  grid-column: 3;
}

.layout img {
  max-width: 100%;
}

.layout>*:nth-child(4) img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
<div class="layout">
  <img src="https://picsum.photos/500">
  <img src="https://picsum.photos/500">
  <img src="https://picsum.photos/1000/500">
  <div>
    <img src="https://picsum.photos/500/1000">
  </div>
</div>




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签