gpt4 book ai didi

css - 将图像居中并在其周围环绕文本,媒体宽度为 768px

转载 作者:太空宇宙 更新时间:2023-11-04 06:15:59 25 4
gpt4 key购买 nike

当窗口宽度低于 768px 时,我希望水平相册图像和文本内容进行转换,以便图像显示在相册文本下方,但位于以下 lorem ipsum 文本上方。我尝试了下面的 CSS 代码,但它不起作用。目前,当窗口下降到 678px 以下时,图像仍位于右侧。

https://jsfiddle.net/x1hkzrvw/3/

@media screen{
.image{
width:20%;
float: right;
border-radius:50%;


}
}
@media(max-width:768px) {
.image{
display: flex;
flex-wrap: wrap;

}
}

最佳答案

添加到 css 下方

p {
display: flex;
flex-wrap: wrap;
}
p img {
order: 2
}
.image {
width: 50%;
height: 100px;
}

@media screen {
.image {
width: 20%;
float: right;
border-radius: 50%;
display: flex;
}
}

@media(max-width:768px) {
p {
display: flex;
flex-wrap: wrap;
}
p img {
order: 2
}
.image {
width: 50%;
height: 100px;
}
}
<div>
<p>
<img src="https://sample-videos.com/img/Sample-jpg-image-500kb.jpg" alt="Italian Trulli" class="image"> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the
1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the
1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic
typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software. It is a long established fact that a reader will
be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable
English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes
by accident, sometimes on purpose (injected humour and the like). It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less
normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem
ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
</p>
</div>

关于css - 将图像居中并在其周围环绕文本,媒体宽度为 768px,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55962587/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com