css平常用到的样式

 设置图片浮在控件上面,绝对定位

图例:

css代码:

 

.input_wrap {
    margin: 10px; // 像左和上移动10个像素
    position: relative;
    font-size: 16px;
}

.g_input {
    width: 50%;
    height: 40px;
}

.input_wrap .g_input {
    padding-right: 20px;// 控制文本输入框像右偏移多少像素
    position: relative;
}

.input_wrap .close {
    position: absolute;
    width: 100%; // g_input样式百分比增加或减少,对应的百分比是需要调整
    height: 45px;
    right: 0;
    top: 0;
    background: url(icons-close.png) no-repeat center center;
    background-size: 26px auto;
}

 

html样例代码:
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
	<link rel="stylesheet" href="index.css"/>
</head>
<body>
	<div class="input_wrap">
      <input type="text" class="g_input">
	  <a href="javascript:void(0)" id="close" class="close"></a>
	</div>
</body>
</html>
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值