CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  多媒体/设计/Flash开发 >  网页设计(Dreamweaver等)

关于CSS的!

楼主0033(夜番索)2005-06-01 11:31:33 在 多媒体/设计/Flash开发 / 网页设计(Dreamweaver等) 提问

请教个位高手,我在网页中新建了一个CSS,结果整个页面的链接都边成那个CSS的样式,这是怎么回事?  
   
  还有一个问题,就是如何做那种很常见的在,正页两边挂着的广告条? 问题点数:0、回复次数:9Top

1 楼samgg()回复于 2005-06-01 17:31:43 得分 0

请教个位高手,我在网页中新建了一个CSS,结果整个页面的链接都边成那个CSS的样式,这是怎么回事?  
   
  因为:你的网页里的链接没有设CLASS,所以全部链接变成那个CSS了(——默认样式),你可以去参考一下别人网站的HTML代码和它的CSS代码。  
   
  =======================================================  
   
  还有一个问题,就是如何做那种很常见的在,正页两边挂着的广告条?  
   
  因为:可以用JS或JAVASCRIPT来实现。  
   
  Top

2 楼jj5378960(网事随峰)回复于 2005-06-02 10:42:47 得分 0

问题1----  
   
  你可以多建几个样式的,比如.a     .b等等...把要新的文字选中,加上新的样式就可以了.不知道你是不是这个意思..  
   
  问题2---  
   
   
  1你可以下载一个插件的,很方便,在DW中几步即可完成..  
   
   
  2以下代码插入到body上面----------------  
  <script   LANGUAGE="JavaScript">  
  self.onError=null;  
  currentX   =   currentY   =   0;    
  whichIt   =   null;    
  lastScrollX   =   0;   lastScrollY   =   0;  
  NS   =   (document.layers)   ?   1   :   0;  
  IE   =   (document.all)   ?   1:   0;  
  <!--   STALKER   CODE   -->  
  function   heartBeat()   {  
  if(IE)   {   diffY   =   document.body.scrollTop;   diffX   =   document.body.scrollLeft;   }  
  if(NS)   {   diffY   =   self.pageYOffset;   diffX   =   self.pageXOffset;   }  
  if(diffY   !=   lastScrollY)   {  
  percent   =   .1   *   (diffY   -   lastScrollY);  
  if(percent   >   0)   percent   =   Math.ceil(percent);  
  else   percent   =   Math.floor(percent);  
  if(IE)   document.all.floater.style.pixelTop   +=   percent;  
  if(NS)   document.floater.top   +=   percent;    
  lastScrollY   =   lastScrollY   +   percent;  
  }  
  if(diffX   !=   lastScrollX)   {  
  percent   =   .1   *   (diffX   -   lastScrollX);  
  if(percent   >   0)   percent   =   Math.ceil(percent);  
  else   percent   =   Math.floor(percent);  
  if(IE)   document.all.floater.style.pixelLeft   +=   percent;  
  if(NS)   document.floater.left   +=   percent;  
  lastScrollX   =   lastScrollX   +   percent;  
  }    
  }  
  <!--   /STALKER   CODE   -->  
  <!--   DRAG   DROP   CODE   -->  
  function   checkFocus(x,y)   {    
  stalkerx   =   document.floater.pageX;  
  stalkery   =   document.floater.pageY;  
  stalkerwidth   =   document.floater.clip.width;  
  stalkerheight   =   document.floater.clip.height;  
  if(   (x   >   stalkerx   &&   x   <   (stalkerx+stalkerwidth))   &&   (y   >   stalkery   &&   y   <   (stalkery+stalkerheight)))   return   true;  
  else   return   false;  
  }  
  function   grabIt(e)   {  
  if(IE)   {  
  whichIt   =   event.srcElement;  
  while   (whichIt.id.indexOf("floater")   ==   -1)   {  
  whichIt   =   whichIt.parentElement;  
  if   (whichIt   ==   null)   {   return   true;   }  
  }  
  whichIt.style.pixelLeft   =   whichIt.offsetLeft;  
  whichIt.style.pixelTop   =   whichIt.offsetTop;  
  currentX   =   (event.clientX   +   document.body.scrollLeft);  
  currentY   =   (event.clientY   +   document.body.scrollTop);    
  }   else   {    
  window.captureEvents(Event.MOUSEMOVE);  
  if(checkFocus   (e.pageX,e.pageY))   {    
  whichIt   =   document.floater;  
  StalkerTouchedX   =   e.pageX-document.floater.pageX;  
  StalkerTouchedY   =   e.pageY-document.floater.pageY;  
  }    
  }  
  return   true;  
  }  
  function   moveIt(e)   {  
  if   (whichIt   ==   null)   {   return   false;   }  
  if(IE)   {  
  newX   =   (event.clientX   +   document.body.scrollLeft);  
  newY   =   (event.clientY   +   document.body.scrollTop);  
  distanceX   =   (newX   -   currentX);   distanceY   =   (newY   -   currentY);  
  currentX   =   newX;   currentY   =   newY;  
  whichIt.style.pixelLeft   +=   distanceX;  
  whichIt.style.pixelTop   +=   distanceY;  
  if(whichIt.style.pixelTop   <   document.body.scrollTop)   whichIt.style.pixelTop   =   document.body.scrollTop;  
  if(whichIt.style.pixelLeft   <   document.body.scrollLeft)   whichIt.style.pixelLeft   =   document.body.scrollLeft;  
  if(whichIt.style.pixelLeft   >   document.body.offsetWidth   -   document.body.scrollLeft   -   whichIt.style.pixelWidth   -   20)   whichIt.style.pixelLeft   =   document.body.offsetWidth   -   whichIt.style.pixelWidth   -   20;  
  if(whichIt.style.pixelTop   >   document.body.offsetHeight   +   document.body.scrollTop   -   whichIt.style.pixelHeight   -   5)   whichIt.style.pixelTop   =   document.body.offsetHeight   +   document.body.scrollTop   -   whichIt.style.pixelHeight   -   5;  
  event.returnValue   =   false;  
  }   else   {    
  whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);  
  if(whichIt.left   <   0+self.pageXOffset)   whichIt.left   =   0+self.pageXOffset;  
  if(whichIt.top   <   0+self.pageYOffset)   whichIt.top   =   0+self.pageYOffset;  
  if(   (whichIt.left   +   whichIt.clip.width)   >=   (window.innerWidth+self.pageXOffset-17))   whichIt.left   =   ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;  
  if(   (whichIt.top   +   whichIt.clip.height)   >=   (window.innerHeight+self.pageYOffset-17))   whichIt.top   =   ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;  
  return   false;  
  }  
  return   false;  
  }  
  function   dropIt()   {  
  whichIt   =   null;  
  if(NS)   window.releaseEvents   (Event.MOUSEMOVE);  
  return   true;  
  }  
  <!--   DRAG   DROP   CODE   -->  
  if(NS)   {  
  window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);  
  window.onmousedown   =   grabIt;  
  //window.onmousemove   =   moveIt;//如果想移动的话,打开前面的注释  
  window.onmouseup   =   dropIt;  
  }  
  if(IE)   {  
  document.onmousedown   =   grabIt;  
  //document.onmousemove   =   moveIt;//如果想移动的话,打开前面的注释  
  document.onmouseup   =   dropIt;  
  }  
  if(NS   ||   IE)   action   =   window.setInterval("heartBeat()",1);  
  </script>    
  在body里面......ID名要相同.................  
   
  <div   ID="floater"   style="   //position:absolute;   left:935px;   top:175;   width:58px;   height:64px;   z-index:100   ">  
  <table   width="69"   height="77"   border="0"   cellpadding="0"   cellspacing="0">  
  <tr>  
  <td   background="images_j_2/fei.jpg"   class="zhi">&nbsp;</td>  
  </tr>  
  </table>  
  </div>  
   
   
  记住,SCRIPT中的ID名和层的ID名一定要相同...  
  Top

3 楼x810929(鸭)回复于 2005-06-04 10:21:04 得分 0

楼上正解Top

4 楼cczeyun(泽云)回复于 2005-06-04 17:06:43 得分 0

支持楼上Top

5 楼starsoulxp(星魂)回复于 2005-06-04 19:45:52 得分 0

呵呵,来晚了。楼上都说了Top

6 楼robinsuper(草雉京)回复于 2005-06-07 00:00:17 得分 0

css照着三楼的作吧  
  正页两边挂着的广告条代码在给你一个  
   
  <html>  
   
  <head>  
  <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">  
  <title>新建网页   1</title>  
  </head>  
   
  <body   background="bg.jpg">  
  <script   language   =   "JavaScript">  
  //左边  
  var   left_img='<a   href=http://www.pconline.com.cn   title=心雨动网祝大家万事如意,笑口常开><img   src=http://www.xydw.com/other/images/happynew.gif   border=0></a>';  
   
  //右边  
  var   right_img='<a   href=http://www.pconline.com.cn   title=心雨动网祝大家万事如意,笑口常开><img   src=http://www.xydw.com/other/images/happynew.gif   border=0></a>';  
  var   delta=0.05  
  var   collection;  
  function   floaters()   {  
  this.items=   [];  
  this.addItem=   function(id,x,y,content)  
      {  
  document.write('<DIV   id='+id+'   style="Z-INDEX:   10;   POSITION:   absolute;     width:80px;   height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>');  
   
  var   newItem=   {};  
  newItem.object=   document.getElementById(id);  
  newItem.x=   x;  
  newItem.y=   y;  
   
  this.items[this.items.length]=   newItem;  
      }  
  this.play=   function()  
      {  
  collection=   this.items  
  setInterval('play()',10);  
      }  
  }  
  function   play()  
  {  
   
  for(var   i=0;i<collection.length;i++)  
  {  
  var   followObj=   collection[i].object;  
  var   followObj_x=   (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);  
  var   followObj_y=   (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);  
   
  if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x))   {  
  var   dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;  
  dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));  
  followObj.style.left=followObj.offsetLeft+dx;  
  }  
   
  if(followObj.offsetTop!=(document.body.scrollTop+followObj_y))   {  
  var   dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;  
  dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));  
  followObj.style.top=followObj.offsetTop+dy;  
  }  
  followObj.style.display=   '';  
  }  
  }  
   
  var   theFloaters=   new   floaters();  
  theFloaters.addItem('followDiv1','document.body.clientWidth-100',230,''+right_img+'');  
  theFloaters.addItem('followDiv2',20,230,''+left_img+'');  
  theFloaters.play();  
  </script>  
   
  </body>  
   
  </html>  
   
   
   
   
  Top

7 楼jj5378960(网事随峰)回复于 2005-08-23 15:29:06 得分 0

我都回答你的问题了,楼主,为何不散分啊.....呵呵Top

8 楼walkerabc(小不懂)回复于 2005-08-23 15:47:45 得分 0

<LINK   rel="stylesheet"   type="text/css"   href="../Styles.css">  
  css要看你怎么引用了啊,对于不通的区域或者内容,应当使用不通的class或者cssclass  
   
  ============================================================================  
  <html>  
   
  <head>  
  <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">  
  <title>新建网页   1</title>  
  </head>  
   
  <body   background="bg.jpg">  
  <script   language   =   "JavaScript">  
  //左边  
  var   left_img='<a   href=http://www.pconline.com.cn   title=心雨动网祝大家万事如意,笑口常开><img   src=http://www.xydw.com/other/images/happynew.gif   border=0></a>';  
   
  //右边  
  var   right_img='<a   href=http://www.pconline.com.cn   title=心雨动网祝大家万事如意,笑口常开><img   src=http://www.xydw.com/other/images/happynew.gif   border=0></a>';  
  var   delta=0.05  
  var   collection;  
  function   floaters()   {  
  this.items=   [];  
  this.addItem=   function(id,x,y,content)  
      {  
  document.write('<DIV   id='+id+'   style="Z-INDEX:   10;   POSITION:   absolute;     width:80px;   height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>');  
   
  var   newItem=   {};  
  newItem.object=   document.getElementById(id);  
  newItem.x=   x;  
  newItem.y=   y;  
   
  this.items[this.items.length]=   newItem;  
      }  
  this.play=   function()  
      {  
  collection=   this.items  
  setInterval('play()',10);  
      }  
  }  
  function   play()  
  {  
   
  for(var   i=0;i<collection.length;i++)  
  {  
  var   followObj=   collection[i].object;  
  var   followObj_x=   (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);  
  var   followObj_y=   (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);  
   
  if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x))   {  
  var   dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;  
  dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));  
  followObj.style.left=followObj.offsetLeft+dx;  
  }  
   
  if(followObj.offsetTop!=(document.body.scrollTop+followObj_y))   {  
  var   dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;  
  dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));  
  followObj.style.top=followObj.offsetTop+dy;  
  }  
  followObj.style.display=   '';  
  }  
  }  
   
  var   theFloaters=   new   floaters();  
  theFloaters.addItem('followDiv1','document.body.clientWidth-100',230,''+right_img+'');  
  theFloaters.addItem('followDiv2',20,230,''+left_img+'');  
  theFloaters.play();  
  </script>  
   
  </body>  
   
  </html>  
   
   
  Top

9 楼yunfeitiger(飞云虎)回复于 2005-08-23 18:04:44 得分 0

在html中因<a>是链接的标识符,所以若你在CSS中写入了  
   
  a{...}  
   
  的话,就说明整个网页的<a>标签下的链接全部样式都一样。解决办法是在CSS的标识前加一个“.”,然后在需要这个样式的链接处加class属性即可,如:  
   
  <!--   CSS中或在网页的<style>标签中   -->  
  .style1{...}  
  .style2{...}  
   
  <!--   网页中   -->  
  <a   href="..."   class="style1">link_a</a>  
  <a   href="..."   class="style2">link_b</a>Top

相关问题

  • css
  • .css
  • CSS~~~
  • CSS Attributes
  • 关于css???急!!!
  • <!--@import"css/cssset/.css-->,css/cssset/.css是什么意思?
  • css问题
  • 有关css
  • CSS的困惑
  • CSS问题

关键词

得分解答快速导航

  • 帖主:0033

相关链接

  • CSDN Blog
  • 技术文档
  • 代码下载
  • 第二书店
  • 读书频道

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo