标签:
css切图还是蛮难的!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML1.0 Strict //EN" "http://www.w3.org/TR/xhtml/DTD/xhtml1-strict.dtd"> <html> <head> <style type="text/css"> div { padding : 0px;} .header { border : 3px solid green;padding : 10px;position:relative;} .header:after { content : ""; clear : both; display : block; visibility : hidden; height : 0; } .header { zoom : 1; } .logo { float : left ; width : 100px; height : 100px; border : 3px solid red; } .user { float : right ; width : 200px; border : 3px solid #000; text-align : right; position : absolute; bottom:10px; right : 10px; } #content { margin : 10px 0;} #content:after { content : ""; clear : both; display : block; visibility : hidden; height : 0; } .aside { width :200px; margin-left : 25px; border:3px solid red; float : right; } .content { height : 600px; border : 3px solid purple; margin-right : 220px; } .footer { text-align : center; border : 3px solid blue;} </style> </head> <body> <div class = "header"> <div class = "logo">Logo</div> <div class = "user"> <span>用户名 </span></div> </div> <div id = "content"> <div class = "aside">aside - 定宽 200px</div> <div class = "content">content - 自适应宽度</div> </div> <div class = "footer">footer</div> </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML1.0 Strict //EN" "http://www.w3.org/TR/xhtml/DTD/xhtml1-strict.dtd"> <html> <head> <style type="text/css"> div { padding : 0px;} .header { border : 3px solid green;padding : 10px;position:relative;} .header:after { content : ""; clear : both; display : block; visibility : hidden; height : 0; } .header { zoom : 1; } .logo { float : left ; width : 100px; height : 100px; border : 3px solid red; } .user { float : right ; width : 200px; border : 3px solid #000; text-align : right; position : absolute; bottom:10px; right : 10px; } #content { margin : 10px 0;} #content:after { content : ""; clear : both; display : block; visibility : hidden; height : 0; } .left { float : left; width:100%; } .aside { width :200px; margin-left : -206px; //这句好关键啊!!! border:3px solid red; float : left; } .content { height : 600px; border : 3px solid purple; margin-right : 220px; } .footer { text-align : center; border : 3px solid blue;} </style> </head> <body> <div class = "header"> <div class = "logo">Logo</div> <div class = "user"> <span>用户名 </span></div> </div> <div id = "content"> <div class = "left"> <div class = "content">content - 自适应宽度</div> </div> <div class = "aside">aside - 定宽 200px</div> </div> <div class = "footer">footer</div> </body> </html>
标签:
原文地址:http://www.cnblogs.com/shixiaomiao/p/4821270.html