Rumah >hujung hadapan web >html tutorial >为什么我的实际效果达不到想要的效果啊!主要是li标签的浮动效果影响的,在样式里用了clear属性还是解决不了。_html/css_WEB-ITnose
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Transitional//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="content-type" content="text/html ; charset=utf-8"/><style>body{font-family:"Helvetica","Arial",sans-serif;color:#333;background-color:#ccc;margin:1em 10%;height:550px;width:1024px;}h1{color:#333;background-color:transparent;}a{color:#c60;background-color:transparent;font-weight:bold;text-decoration:none;}ul{float:left;padding:0;}li{float:left;padding:1em;list-style:none;clear:right;}img{clear:both;}</style> <title> Image Gallery </title> </head> <body> <h1>Snapshots</h1> <ul> <li> <a href="images/1.jpg" onclick="showPic(this); return false;" title="A fireworks display">Fireworks</a> </li> <li> <a href="images/2.jpg" onclick="showPic(this); return false;" title=" A cup of black coffee"> Coffee</a> </li> <li> <a href="images/3.jpg" onclick="showPic(this); return false;" title="A red ,red rose ">Rose</a> </li> <li> <a href="images/4.jpg" onclick="showPic(this); return false;" title=" The famous clock"> Big Ben</a> </li> </ul> <img src="images/5.jpg" alt="my image ga llery" id="placeholder"></img> <p id="description">Choose an image.</p> </body></html>
Choose an image.