css - 如何使用 css 在顶部添加功能区?

标签 css position ribbon

我拼命尝试在我的页面右上角添加这个小 png 丝带。完全像这个:http://www.thebestdesigns.com/

我已经检查了他们的代码,但是当我在我的代码中使用它时,它变得一团糟。看一看:

<style>

 html,body {
   background-color: #edecd8;

   margin:0;
   padding:0;
    height:100%;

 }

   #container {min-height:100%; position:relative;}



  #body {
    padding-bottom:20px;
  }


  a {text-decoration: none; color: black;}
  a:hover {color: #555555; border-bottom: 1px dotted black; }


#footer {
  position:absolute;
  bottom:0;
  width:100%;
  height:20px;/* Height of the footer */
  background: #edecd8;
  background-image:url(pattern.png);
  text-align:center;
  font-family: Century Gothic, sans-serif;
  font-size: 14px;
  font-variant: small-caps;
  }


.intro {
font-family: Century Gothic, sans-serif;
font-size: 15px;
font-variant: small-caps;
}

span.bottom {
    text-align: center;
    width:100%;
    position:absolute;
    bottom:0;   }

#mytable {
padding-top:30px;
}


</style>


</head>

<body>


 <div id="container">


 <div id="body">

<center>
<table div id="mytable" width="650" border="0" cellspacing="0" cellpadding="5" >
    <tbody>
    <tr>
      <td align="center" height="40"><img src="logo.jpg" alt="XXXX" width="100" height="30"></td>
    </tr>
    <tr>
      <td height="20" align="center" class="intro"> <a href="">online store</a> | <a href="">main website</a></td>
    </tr>
    <tr>
      <td height="352" align="center"><img src="ku.jpg" width="500" height="500"></td>
    </tr>
  </tbody>
  </table>
 </center>


  </div>



  <!-- Ola sto span class mporoun na xwresoun? -->
 <div id="footer"><span style class="bottom">  n@hotmail.com | the athens store | Mitropoleos 37 | t: 2xx00    </div>
 </div>


</body>

</html>

我试过类似的东西,但是当我把它放在我拥有的两个 div 中时它就起来了。我能做些什么?有什么建议吗?

#ribbon {
position: absolute;
right: 0;
top: 0;
z-index: 1000;
}

最佳答案

这是功能区所需的全部代码:

HTML

<div id="new-themes">
    <a href="/design/themes/">Wordpress Themes</a>
</div>

CSS

#new-themes {
  position: absolute;
  right: 0;
  top: 0;
  z-index: 1000;
}

#new-themes a {
  background: url("/deck/wp-content/themes/tbd/images/ribbon-themes-red.png") no-repeat;
  display: block;
  height: 140px;
  width: 140px;
  text-indent: -9000px;
}

一定要将 div 放在我们的正文中。

关于css - 如何使用 css 在顶部添加功能区?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7934910/

相关文章:

c# - 图像在 WPF 功能区控件中无法正确呈现

css - 成 Angular ,将 CSS 色带包裹在图像上

wpf - 如何开始在 WPF 中使用功能区

css - 哪种测量最适合使用?

c++ - 让两个窗口毫不拖延地粘在一起

html - CSS 将 div 分配给任何百分比最终会填满整个屏幕?

html - 页脚 div 不会粘在页面底部

css - 流体 div,一个带有要排列的图像?

css - iPad 上的 HTML5 视频 css 背景颜色

css - LESS.JS CSS 中的冗余,使用 Mixins 而不是选择器继承?