html – CSS背景位置右上角

html – CSS背景位置右上角,第1张

概述我希望按钮上的 背景图像出现在右上角. 我成功使用了背景位置:底部顶部100px将图像移动到顶部,但我没有成功将图像向右移动. 是否有类似于背景位置的东西:底部顶部100px,右侧900px可能有助于产生所需的结果? #AddNewMeetingButton { position: absolute; top: 0; text-align: center; back 我希望按钮上的

背景图像出现在右上角.

我成功使用了背景位置:底部顶部100px将图像移动到顶部,但我没有成功将图像向右移动.

是否有类似于背景位置的东西:底部顶部100px,右侧900px可能有助于产生所需的结果?

#AddNewMeetingbutton {    position: absolute;    top: 0;    text-align: center;    background-image: url(Images/add_icon_48x48.png);    background-position: bottom top 100px,right 800px;    background-repeat: no-repeat;    height: 190px;    wIDth: 915px;    background-color: transparent;    outline: none;    border: none;    z-index: 2;}
解决方法 像这样的东西

background-image: url(http://i.stack.imgur.com/cW9aK.png);background-repeat: no-repeat;background-size: 48px 48px;background-position: right 10px top 10px;

JSfiddle Demo

MDN Reference

background-position:<position> where:

<position> is one to four values representing a 2D position regarding the edges of the element’s Box. relative or absolute offsets can be given. Note that the position can be set outsIDe of the element’s Box.

所以:

background-position: right 10px top 10px;

将图像置于顶部/右侧,但距离右边缘10px,距顶边缘10px

总结

以上是内存溢出为你收集整理的html – CSS背景位置右上角全部内容,希望文章能够帮你解决html – CSS背景位置右上角所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1082965.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存