作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我的代码:
a{
display: block;
border: 3px solid #ffcb08;
border-radius: 100px;
text-align: center;
color: #222;
text-decoration: none;
font-weight: 300;
font-size: 20px;
padding: 10px;
box-sizing: border-box;
margin-top: 15px;
transition: all .3s;
-webkit-transition: all .3s;
-moz-transition: all .3s;
width: 160px;
float: right;
}
p{
border: 1px solid;
}
<p>
some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here.
<a href="#">Download</a>
</p>
我想做的就是将该按钮放在右侧,而不对其设置 position: absolute;
。我该怎么做?
最佳答案
您可以通过多种方式做到这一点,这里是Flexbox方式:
text {
display: flex;
flex-direction: column; /* vertical stacking */
/* align-items: flex-end; affects all flex-items */
}
a {
align-self: flex-end; /* affects only this flex-item */
display: block;
border: 3px solid #ffcb08;
border-radius: 100px;
text-align: center;
color: #222;
text-decoration: none;
font-weight: 300;
font-size: 20px;
padding: 10px;
box-sizing: border-box;
margin-top: 15px;
transition: all .3s;
-webkit-transition: all .3s;
-moz-transition: all .3s;
width: 160px;
}
<text>
some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here.
<a href="#">Download</a>
</text>
关于javascript - 我怎样才能把链接放在右边?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47323543/
我必须为 IE11 编写一些网格回退。 我想将元素 4 放在右下角,以便元素 1 可以一直向下延伸到底部吗? 我认为这对 flexbox 来说是不可能的,对吧? : https://jsfiddle.
您好,我正在尝试让 2 个 div 在左侧与右侧对齐。 #div1 #div2 #div1 #div2 #div3 #div2 #div3 #div3 诀窍是当浏览器窗口变小时,我希望#div2 位于
如何才能点击 EditText 的右侧可绘制对象(查看屏幕截图)?我尝试了几种方法,但总是卡住。 public static Matcher withEditTextDrawable(final in
这个问题在这里已经有了答案: In CSS Flexbox, why are there no "justify-items" and "justify-self" properties? (6
所以我有 10 个复选框,每个标签都取自数组中相应的索引。我正在使用 ng-repeat 来展示它们: {{entity}}
我是一名优秀的程序员,十分优秀!