Html bootstrap center图像横向iphone
使用boostrap 3,在头版我有一张图片。它的中心很好,但当在横向中使用iphone或平板电脑时,图像太大。你能告诉我如何使它对景观也有反应吗 试试这个:Html bootstrap center图像横向iphone,html,css,twitter-bootstrap-3,Html,Css,Twitter Bootstrap 3,使用boostrap 3,在头版我有一张图片。它的中心很好,但当在横向中使用iphone或平板电脑时,图像太大。你能告诉我如何使它对景观也有反应吗 试试这个: <img src="..." class="img-responsive"> 尝试将最大高度:100vh添加到图像的CSS中。如果没有看到您的代码,很难确定,但是应该可以工作。img响应类应用的最大宽度为100%。因此,在容器填充视口的较小设备上的横向模式下,如果图像是设备的宽度,则图像将在顶部和底部被切断。此外,您的身体
<img src="..." class="img-responsive">
尝试将最大高度:100vh
添加到图像的CSS中。如果没有看到您的代码,很难确定,但是应该可以工作。img响应类应用的最大宽度为100%。因此,在容器填充视口的较小设备上的横向模式下,如果图像是设备的宽度,则图像将在顶部和底部被切断。此外,您的身体上设置了55px的上边距,这进一步降低了设备在横向方向上的可视高度
在横向模式下使用媒体查询以目标设备删除主体边距,并更改img响应类以将图像调整为最大高度而不是最大宽度,应该可以解决此问题
@media screen and (max-device-width: 1000px) and (orientation:landscape){
body {
margin-top: 0px;
}
.img-responsive {
max-width: initial;
max-height: 100vh;
}
}
如果您真的想简化登录页,使其在所有视口中垂直和水平居中,您可以删除所有无关的div,只需执行以下操作:
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Core CSS -->
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<style>
img {
max-height: 100%;
max-width: 100%;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
</style>
</head>
<body>
<a href="http://garveydoyle.ie/sitenew/about-us/">
<img class="loading" src="http://garveydoyle.ie/sitenew/wp-content/themes/roots/assets/img/loading.jpg" alt="garvey doyle" />
</a>
</body>
</html>
img{
最大高度:100%;
最大宽度:100%;
位置:绝对位置;
排名:0;
底部:0;
左:0;
右:0;
保证金:自动;
}
因为你的问题是关于Twitter引导框架的,你可能想在你的问题中添加标签?直到几周前我都没有。警告,这对你没用