尝试将图像与 bootstrap 中列的右中间对齐
Trying to align an image to the right middle of a column in bootstrap
我正在尝试将 bootstrap 列中的图像右对齐,并让文本在左侧环绕图像,如下所示:https://codepen.io/freeCodeCamp/full/YqLyXB
我整天都在研究 flexbox 和垂直对齐,而不是做我的工作(糟糕),觉得是时候问问专家了。这是我的样子:
https://codepen.io/Seaplush/pen/rKVLmX
.col2 img{
max-width: 100%;
height: 50%;
float: right;
}
.col2{
background-color: #cccccc;
height: 50vh;
display: flex;
flex-wrap: wrap;
align-items: center;
}
感谢您的帮助,这是我的第一个网站尝试,如果浏览起来有点乱,请见谅 ;)
您可以使用 bootstrap 列。只需阅读并进一步了解 Bootstrap 网格。
请阅读以下链接:
如果您使用 bootstrap,为什么不使用 bootstrap 网格布局?
但是如果你尝试使用 flex box,这是一些提示...
您应该设置文本和图像的宽度...
将这 2 个元素的父元素设置为 flex,并设置对齐内容。
示例:
.parent{
display:flex;
align-content:space-around;
}
我正在尝试将 bootstrap 列中的图像右对齐,并让文本在左侧环绕图像,如下所示:https://codepen.io/freeCodeCamp/full/YqLyXB
我整天都在研究 flexbox 和垂直对齐,而不是做我的工作(糟糕),觉得是时候问问专家了。这是我的样子: https://codepen.io/Seaplush/pen/rKVLmX
.col2 img{
max-width: 100%;
height: 50%;
float: right;
}
.col2{
background-color: #cccccc;
height: 50vh;
display: flex;
flex-wrap: wrap;
align-items: center;
}
感谢您的帮助,这是我的第一个网站尝试,如果浏览起来有点乱,请见谅 ;)
您可以使用 bootstrap 列。只需阅读并进一步了解 Bootstrap 网格。
请阅读以下链接:
如果您使用 bootstrap,为什么不使用 bootstrap 网格布局?
但是如果你尝试使用 flex box,这是一些提示...
您应该设置文本和图像的宽度...
将这 2 个元素的父元素设置为 flex,并设置对齐内容。
示例:
.parent{
display:flex;
align-content:space-around;
}