- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有用于证明的 HTML 和 CSS,在 JSFIDDLE DEMO 中.这里的问题是“:after”内容在移动 View 中放错位置或者没有正确对齐,我需要对齐它,以便它在移动 View 和普通 View 中都需要处于恒定位置,任何人都有一些想法?
<div>
<div class="testi-inno" id="testi-one">
<p>“this place having some text, which is of lorger or amaller size”</p>
</div>
</div>
<div class="testi-img" style="clear:both;">
<img src="" alt=" " width="70" height="70"/>
</div>
<p class="testi-par">name of client</p>
<p class="testi-paras">designation</p>
</div>
CSS:
.testi-inno p:after {
content: ' ';
position: absolute;
width: 0;
height: 0;
border-right: 20px solid transparent;
border-top: 20px solid #fff;
border-left: 20px solid transparent;
border-bottom: 20px solid transparent;
top: 19%;
left: 42%;
}
.testi-inno{
background:#fff;
margin:10px;
box-shadow: 10px 10px 5px #888888;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
.testi-inno p{
margin:15px;
margin-bottom:15px !important;
padding-top: 10%;
padding-bottom: 10%;
}
.testi-img img{
background-repeat: no-repeat;
background-position: 50%;
border-radius: 50%;
width: 80px;
height: 80px;
margin-top: 7%;
margin-left: 34%;
}
最佳答案
简单的解决方案,只需在“.testi-inno”中使用 Position Relative 因为 Position:relative 控制 Position:absolute
.testi-inno{
background:#fff;
margin:10px;
box-shadow: 10px 10px 5px #888888;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
在你的情况下,你的后值(value) = top: 19%;或离开:42%;根据 Window Walls 工作,但是在你使用 Position:relative 之后,然后 top :19% or left :42% 根据你的 .testi-inno Div 工作,所以它在移动设备上正常工作。第二个错误是如果你需要使箭头居中使用 left : 50%;不是 42%。
.testi-inno p:after {
content: ' ';
position: absolute;
width: 0;
height: 0;
border-right: 20px solid transparent;
border-top: 20px solid #fff;
border-left: 20px solid transparent;
border-bottom: 20px solid transparent;
bottom: 0%;
left: 50%;
margin:0 0 0 -20px;
}
只需检查我的 JSFIDDLE DEMO -
关于html - 我想定位我的 :after content in mobile view or in less resolutions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31042292/
使用登录后,我想吐出用户名。 但是,当我尝试单击登录按钮时, 它给了我力量。 我看着logcat,但是什么也没显示。 这种编码是在说。 它将根据我在登录屏幕中输入的名称来烘烤用户名。 不会有任何密码。
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎是题外话,因为它缺乏足够的信息来诊断问题。 更详细地描述您的问题或include a min
我是一名优秀的程序员,十分优秀!