IE9下,display:inline-block下的子标签position:absolute定位时作用在上面的margin属性失效。

<div style="position: relative;border:1px solid #FF7711; padding-top:4px;">

<a href="#" style="display: inline-block; _zoom:1; width:90px; height:20px;border:1px solid #333333;text-align:center;">

试试新功能<img border="0" src="https://i-blog.csdnimg.cn/blog_migrate/5b8109f5e8c06abc051cd816bcc21ae9.gif" alt="试试新功能" title="试试新功能" style="position: absolute; top: 0px; margin-right: -17px;" />

</a>

</div>

 

如果你用的是IE9的话,你就可用看到下面的效果图:

 

无论如何设置margin-right或者其他margin属性都对它无效。

看效果的话就是被挤出来的样子。

就这样了。

 

补充:其实何必呢?直接在<a>标签上多加一个position:relative; 然后在img里设置:top:-5px; right:5px;就可以解决了。

<style> /* 保持原有样式不变 */ .cart-page-section { background: white; padding: 30px; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); margin-bottom: 30px; } .cart-page-section table.cart { width: 100%; border-collapse: collapse; margin-bottom: 20px; } .cart-page-section table.cart th, .cart-page-section table.cart td { padding: 15px; text-align: left; border-bottom: 1px solid #eee; } .cart-page-section table.cart th { background-color: #f8f8f8; font-weight: bold; } .cart-page-section table.cart th.product-select, .cart-page-section table.cart td.product-select { width: 8%; text-align: center; vertical-align: middle; white-space: nowrap; } .cart-page-section table.cart td.product-info { width: 37%; vertical-align: top; } .cart-page-section table.cart .product-info .product-image { float: left; margin-right: 15px; width: 100px; height: 100px; } .cart-page-section table.cart .product-info .product-image img { max-width: 100%; height: auto; display: block; } .cart-page-section table.cart .product-info .product-name { overflow: hidden; } .cart-page-section table.cart td.product-price, .cart-page-section table.cart td.product-quantity, .cart-page-section table.cart td.product-subtotal { width: 15%; vertical-align: middle; } /* 添加到现有样式中 */ .add-to-wishlist { display: inline-block; margin-right: 5px; vertical-align: middle; text-decoration: none; } .remove-wrapper { display: inline-block; margin-left: 5px; } .product-remove .remove { display: inline-block; font-size: 20px; line-height: 1; text-decoration: none; color: #ccc; transition: color 0.3s; } .product-remove .remove:hover { color: #f44336; } /* 确保操作列内的按钮在同一行 */ .product-remove { white-space: nowrap; } .add-to-wishlist .wishlist-icon { font-size: 18px; } .cart-page-section table.cart td.product-remove { width: 5%; text-align: center; vertical-align: middle; } .cart-footer-actions { position: sticky; bottom: 0; background: #fff; padding: 15px; border-top: 1px solid #ddd; box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1); z-index: 1000; display: flex; flex-direction: column; gap: 15px; } .footer-left { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; } .coupon-section { display: flex; align-items: center; gap: 10px; } .selected-summary { font-size: 16px; font-weight: bold; flex: 1; } .cart-footer-actions .button { padding: 10px 20px; background-color: #f44336; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; transition: background-color 0.3s; white-space: nowrap; } .cart-footer-actions .button:hover { background-color: #d32f2f; } #partial-checkout { padding: 12px 24px; background-color: #2196F3; color: white; text-decoration: none; border-radius: 4px; display: inline-block; transition: background-color 0.3s; white-space: nowrap; text-align: center; font-weight: bold; } #partial-checkout:hover { background-color: #0b7dda; } #coupon_code { padding: 8px; width: 200px; border: 1px solid #ddd; border-radius: 4px; transition: border-color 0.3s; } #coupon_code:focus { border-color: #2196F3; outline: none; } /* 响应式样式 */ @media (max-width: 768px) { .cart-page-section table.cart thead { display: none; } .cart-page-section table.cart td { display: block; width: 100% !important; text-align: right; padding: 10px; position: relative; padding-left: 50%; } .cart-page-section table.cart td::before { content: attr(data-title); position: absolute; left: 15px; font-weight: bold; text-align: left; } .cart-page-section table.cart .product-info .product-image { float: none; margin: 0 auto 10px; } .cart-footer-actions { flex-direction: column; align-items: flex-start; } .footer-left { width: 100%; justify-content: space-between; } .coupon-section { width: 100%; margin-top: 10px; } .coupon-section input { flex: 1; } .selected-summary { text-align: center; margin-bottom: 10px; } #partial-checkout { width: 100%; padding: 15px; } .cart-footer-actions .button { padding: 12px 15px; margin: 5px 0; width: 100%; text-align: center; } } @media (max-width: 480px) { .cart-page-section { padding: 15px; } .cart-page-section table.cart td { padding-left: 45%; } .cart-page-section table.cart td::before { font-size: 14px; } .cart-footer-actions { padding: 10px; } #coupon_code { width: 100%; } } /* Change WooCommerce AJAX overlay color to black */ .blockUI.blockOverlay { background-color: #000 !important; opacity: 0.3 !important; } </style> is my style in cart.php correct?
09-16
<div class="container"> <div class="top"> <!-- 左侧LOGO --> <div class="logo"> <img src="/plugin_assets/polls/images/icon-company.png" alt="公司图标"> <div class="logo-text"> <div class="company-name">武汉光庭信息技术股份有限...</div> <div class="platform-name">数字化学习平台</div> </div> </div> <!-- 中间导航 --> <div class="nav"> <div class="nav-item"> <img src="/plugin_assets/polls/images/icon-home.png" alt="首页"> <span>首页</span> </div> <div class="nav-item"> <img src="/plugin_assets/polls/images/icon-student.png" alt="学生中心"> <span>学生中心</span> </div> <div class="nav-item"> <img src="/plugin_assets/polls/images/icon-shop.png" alt="商城"> <span>商城</span> </div> <div class="nav-item"> <img src="/plugin_assets/polls/images/icon-profile.png" alt="个人中心"> <span>个人中心</span> </div> </div> <!-- 右侧搜索 --> <div class="search"> <input type="text" placeholder="请输入想要的内容"> <a class="search-icon">🔍︎</a> </div> </div> <div class="bottom"> <div class="left"> 左部分(70% 宽度) </div> <div class="right">右部分(30% 宽度)</div> </div> </div> <style> * { box-sizing: border-box; margin: 0; padding: 0; } html, body { height: 100%; } .container { display: flex; flex-direction: column; height: 100vh; } .top { height: 10vh; background-color: #f0f0f0; border-bottom: 1px solid #ccc; display: flex; align-items: center; padding: 0 20px; justify-content: space-between; } .bottom { flex: 1; display: flex; height: 90vh; } .left { flex: 0 0 70%; background-color: #e0e0e0; border-right: 1px solid #ccc; } .right { flex: 0 0 30%; background-color: #d0d0d0; } .top { display: flex; justify-content: space-between; padding-left: 19.5%; padding-right: 13%; box-sizing: border-box; gap: 20px; } .logo { display: flex; align-items: center; } .logo img { width: 38px; height: 38px; margin-right: 15px; } .logo-text { display: flex; flex-direction: column; overflow: hidden; } .company-name { font-size: 18px; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; } .platform-name { font-size: 14px; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; } .nav { display: flex; gap: 150px; align-items: center; } .nav-item { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: #a9a9a9; text-decoration: none; transition: color 0.3s; } .nav-item img { width: 20px; height: 20px; vertical-align: middle; } .nav-item:hover { color: #007bff; } .search { flex: 0 0 300px; position: relative; max-width: 400px; display:inline-block; } .search input { width: 100%; height: 40px; padding-left: 35px; font-size: 14px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; } .search-icon { position: absolute; left: 0; top: 0; height: 100%; width: 30px; display: flex; align-items: center; justify-content: center; pointer-events: none; color: #888; font-size: 16px; background: transparent; border: none; } </style> nav-item 中 span 在 src右侧不是底部
09-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值