CSS制作标签卡

4 篇文章 0 订阅

转自: http://www.happyshow.org/article.asp?id=87

<style type="text/css">
body { font-size:14px; font-family:"宋体"}
ol li { margin:8px}
#con { font-size:12px; width:600px; margin:0 auto}
#tags { height:23px; width:400px; margin:0; padding:0; margin-left:10px}
#tags li { float:left; margin-right:1px; background:url(images/tagleft.gif) no-repeat left bottom; height:23px; list-style-type:none}
#tags li a { text-decoration:none; float:left; background:url(images/tagright.gif) no-repeat right bottom; height:23px; padding:0px 10px; line-height:23px; color:#999}
#tags li.emptyTag { width:4px; background:none}
#tags li.selectTag { background-position: left top; position:relative; height:25px; margin-bottom:-2px}
#tags li.selectTag a { background-position: right top; color:#000; height:25px; line-height:25px;}
#tagContent { padding:1px; background-color:#fff; border:1px solid #aecbd4;}
.tagContent { background:url(images/bg.gif) repeat-x; height:350px;  padding:10px; color:#474747; width:576px; display:none}
#tagContent div.selectTag{ display:block}

</style>
</head>
<body>
<h1>标签示例</h1>
<ol>
 <li>使用 JS+DIV 实现</li>
 <li>标签宽度随文字的数量自适应</li> 
 <li>支持 IE、Firefox</li>
 <li><a href="http://www.happyshow.org/article.asp?id=131" target="_blank">查看此示例的详细</a></li>
 <li><a href="http://www.happyshow.org/article.asp?id=87" target="_blank">查看旧版本</a></li>
 <li><strong>更新时间:2006-11-08</strong></li>
 
</ol>
<div id="con">
  <ul id="tags">
    <li><a href="javascript:void(0)" οnmοuseοver="selectTag('tagContent0',this)">标签一</a></li>
 <li class="selectTag"><a href="javascript:void(0)" οnmοuseοver="selectTag('tagContent1',this)">标签二</a></li>
 <li><a href="javascript:void(0)" οnmοuseοver="selectTag('tagContent2',this)">自适应宽度的标签</a></li>
  </ul>
  <div id="tagContent">
   <div id="tagContent0" class="tagContent">第一个标签的内容</div>
 <div id="tagContent1" class="tagContent selectTag">第二个标签的内容<p>标签背景图1:<img src="images/tagleft.gif" align="top"><br>标签背景图2:<img src="images/tagright.gif" align="top"><br>内容渐变背景图(1象素宽):<img src="images/bg.gif" align="top"></p></div>
 <div id="tagContent2" class="tagContent">第三个标签的内容<p>放大观看标签背景图:<img src="images/tagleft.gif" align="top" width="300" height="100"></p></div>
  </div> 
</div>
<script type="text/javascript">
function selectTag(showContent,selfObj){
 // 操作标签
 var tag = document.getElementById("tags").getElementsByTagName("li");
 var taglength = tag.length;
 for(i=0; i<taglength; i++){
  tag[i].className = "";
 }
 selfObj.parentNode.className = "selectTag";
 // 操作内容
 for(i=0; j=document.getElementById("tagContent"+i); i++){
  j.style.display = "none";
 }
 document.getElementById(showContent).style.display = "block";
 
 
}
</script>
</body> 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个简单的HTML和CSS代码,用于制作一个网页版贺: ``` <!DOCTYPE html> <html> <head> <title>网页版贺</title> <style> body { background-color: #f9f9f9; font-family: Arial, sans-serif; text-align: center; } h1 { color: #ff0000; font-size: 36px; margin-top: 50px; } p { font-size: 24px; margin-top: 20px; } .card { background-color: #ffffff; border: 2px solid #dddddd; border-radius: 10px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); margin: 50px auto; padding: 30px; width: 500px; } .image { max-width: 100%; margin-bottom: 20px; } .button { background-color: #ff0000; border: none; border-radius: 5px; color: #ffffff; cursor: pointer; font-size: 18px; margin-top: 20px; padding: 10px 20px; text-align: center; text-decoration: none; transition: background-color 0.3s ease; } .button:hover { background-color: #cc0000; } </style> </head> <body> <div class="card"> <img class="image" src="https://via.placeholder.com/400x200" alt="贺图片"> <h1>祝你新年快乐!</h1> <p>愿新的一年里,你健康快乐,事业有成,家庭幸福!</p> <a class="button" href="#">发送贺</a> </div> </body> </html> ``` 在这个代码中,我们使用了HTML标签来创建页面内容,CSS来控制样式。首先,我们设置了页面的背景颜色和字体。然后,我们使用一个包含图片、标题、段落和按钮的片容器。最后,我们使用CSS来添加样式,如背景颜色、边框、阴影、圆角、字体大小和按钮样式。通过调整这些样式,您可以创建自己的独特贺
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值