CSS3中,resize属性指定一个元素是否应该由用户去调整大小。这个 div 元素由用户调整大小。 (在 Firefox 4+, Chrome, 和 Safari中)
<!DOCTYPE html> <html> <head> <style> div { border:2px solid; padding:10px 40px; width:300px; resize:both; overflow:auto; } </style> </head> <body> <p><b>Note:</b> Firefox, Safari, and Chrome support the resize property.</p> <div>The resize property specifies whether or not an element is resizable by the user.</div> </body> </html>
box-sizing 属性允许您以确切的方式定义适应某个区域的具体内容。
<!DOCTYPE html> <html> <head> <style> div.container { width:30em; border:1em solid; } div.box { box-sizing:border-box; -moz-box-sizing:border-box; /* Firefox */ width:50%; border:1em solid red; float:left; } </style> </head> <body> <div class="container"> <div class="box">This div occupies the left half.</div> <div class="box">This div occupies the right half.</div> </div> </body> </html>
3、CSS3 外形修饰(outline-offset )
outline-offset 属性对轮廓进行偏移,并在超出边框边缘的位置绘制轮廓。
轮廓与边框有两点不同:轮廓不占用空间、轮廓可能是非矩形。规定边框边缘之外 15 像素处的轮廓:
<!DOCTYPE html> <html> <head> <style> div { margin:20px; width:150px; padding:10px; height:70px; border:2px solid black; outline:2px solid red; outline-offset:15px; } </style> </head> <body> <p><b>Note:</b> Internet Explorer does not support the outline-offset property.</p> <div>This div has an outline border 15px outside the border edge.</div> </body> </html>