Home >Web Front-end >JS Tutorial >Use js to center the image in a div or dl and align the bottom_image special effects

Use js to center the image in a div or dl and align the bottom_image special effects

WBOY
WBOYOriginal
2016-05-16 19:06:321369browse

Solve the problem that the length and width of the image are larger than the container, one side is long and the other is wide, and it is smaller than the container
Passed in both ff and ie
Here is the js code:

Copy code The code is as follows:


 
   脚本之家 www.jb51.net New Document 
  
  
  
  
  
*{margin:0px; padding:0px; font-size:12px;  }
body{ font-size:0.8em; color: #333;}
ul{ list-style:none}
.clear:after {
    content: "."; 
    display: block;
    height: 0; 
    clear: both; 
    visibility: hidden;}
img{border:0px;}
.clear1{    clear: both; width: 100%; height: 1px; overflow: hidden;}
a{ text-decoration: none; color:#404040 }
body{ background:#f7f3d0 url(../images/bg.jpg) repeat-x left 210px;}
/**/
#pic{border:1px solid #000; width:800px; height:auto!important;height:300px; min-height:300px;background:#fff}
#pic dl{width:215px;height:200px; overflow: hidden;border:1px solid #000;margin:10px;float:left}
#pic dt{height:161px; width:209px;overflow:hidden;border:1px solid red;text-align:center}

  
 
 
  
  

 
 



图片1





图片1




图片1





图片1





图片1





图片1





图片1





图片1





图片1





图片1





图片1





图片1







 



包太大上传不了,我把html文件放上来,自己放图片看看就行了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:JavaScript Cookies_Basic KnowledgeNext article:JavaScript Cookies_Basic Knowledge

Related articles

See more