Home Web Front-end HTML Tutorial html+css+jquery to make tabs

html+css+jquery to make tabs

Feb 09, 2018 am 09:27 AM
css

This time I will bring you html+css+jquery to make tabs, and html+css+jquery to make tabs. What are the things to note?The following is a practical case, let's take a look.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>列表选项卡</title> 
<style type="text/css"> 
body{ 
margin:0px; 
padding:0px; 
} 
#main{ 
width:310px; 
border:1px solid #C8C8CC; 
margin-left:auto; 
margin-right
:auto; 
margin-top:50px; 
} 
.main_title{ 
width:310px; 
border-bottom:1px solid #C8C8CC; 
height:30px; 
} 
#main div .chang{ 
border:1px solid #C8C8CC; 
float:left; 
width:153px; 
height:26px; 
text-align:center; 
padding-top
:4px; 
cursor:pointer; 
} 
.main_head{ 
width:310px; 
height:25px; 
background-color
:#FFF4F8; 
} 
.main_head font{ 
font-size:13px; 
color:#808080; 
margin-top:5px; 
} 
.main_content{ 
width:310px; 
border-top:1px solid #808080; 
} 
.main_content ul{ 
margin-left:-30px; 
margin-top:5px; 
width:290px; 
} 
.main_content ul li{ 
list-style-type
:none; 
font-size:13px; 
color:#2464B2; 
border-bottom:1px dotted #808080; 
line-height:27px; 
} 
.main_content ul li a{ 
font-size:13px; 
color:#2464B2; 
text-decoration
:none; 
} 
.main_content ul li a:hover{ 
text-decoration:underline; 
} 
#main div ul.main_content_chang{ 
width:290px; 
position:relative; 
z-index:100; 
top:0px; 
left:0px; 
display:block; 
} 
#main div ul{ 
position:relative; 
display:none; 
} 
</style> 
<script type="text/javascript" src="js/jquery-1.9.1.js"></script> 
<script type="text/javascript"> 
$(function(){ 
$(".chang").each(function(index){ 
$(this).click(function(){ 
$(this).css("background-color","#E02D29"); 
$(this).siblings("div").css("background-color","#fff"); 
$("#main div ul").removeClass("main_content_chang"); 
$(".main_content ul:eq("+index+")").show().siblings("ul").hide(); 
}) 
}) 
}) 
</script> 
</head> 
<body> 
<div id="main"> 
<div class="main_title"> 
<div class="chang" style="background:#E02D29">实时热点</div> 
<div class="chang" style="float:right;">七日关注</div> 
</div> 
<div class="main_content"> 
<!-----------实时热点--------------> 
<ul class="main_content_chang"> 
<li><img src="img/1_1.jpg"/> <a href="#">来自星星你的</a></li> 
<li><img src="img/1_2.jpg"/> <a href="#">私人定制的</a></li> 
<li><img src="img/3_1.jpg"/> <a href="#">全能星战的</a></li> 
<li><img src="img/1_4.jpg"/> <a href="#">加多宝陪千万的</a></li> 
<li><img src="img/1_5.jpg"/> <a href="#">女生厕所产子之后上课的</a></li> 
<li><img src="img/1_6.jpg"/> <a href="#">圆通夺命快递始末的</a></li> 
<li><img src="img/1_7.jpg"/> <a href="#">翻版张柏芝的</a></li> 
<li><img src="img/1_8.jpg"/> <a href="#">李彦鹏说谎的</a></li> 
<li><img src="img/1_9.jpg"/> <a href="#">1.7亿元存折的</a></li> 
<li><img src="img/1_10.jpg"/> <a href="#">90后为讨好男友溺死亲生女的</a></li> 
<li style="text-align:right; border-bottom-style:none"><a href="#" style="font-size:15px">查看完整榜单</a></li> 
</ul> 
<!-----------七日关注--------------------> 
<ul> 
<li><img src="img/1_1.jpg"/> <a href="#">南京出土神秘宝剑的</a></li> 
<li><img src="img/1_2.jpg"/> <a href="#">民政局*的</a></li> 
<li><img src="img/3_1.jpg"/> <a href="#">沃尔玛道歉的</a></li> 
<li><img src="img/1_4.jpg"/> <a href="#">买发卡的女孩的</a></li> 
<li><img src="img/1_5.jpg"/> <a href="#">假茅台骗两亿贷款的</a></li> 
<li><img src="img/1_6.jpg"/> <a href="#">男子收到亡妻圣诞大礼的</a></li> 
<li><img src="img/1_7.jpg"/> <a href="#">全球最美的100的</a></li> 
<li><img src="img/1_8.jpg"/> <a href="#">陨石八千万</a></li> 
<li><img src="img/1_9.jpg"/> <a href="#">安培参拜靖国神社</a></li> 
<li><img src="img/1_10.jpg"/> <a href="#">春晚舞台曝光</a></li> 
<li style="text-align:right; border-bottom-style:none"><a href="#" style="font-size:15px">查看完整榜单</a></li> 
</ul> 
</div> 
</div> 
</body> 
</html>
Copy after login

I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:

How to prompt the save action after a form uploads a file

How to use a button to trigger the flashing of the background color

How to convert table data in html to Json format

How to upload files asynchronously in html

The above is the detailed content of html+css+jquery to make tabs. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use bootstrap in vue How to use bootstrap in vue Apr 07, 2025 pm 11:33 PM

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

How to write split lines on bootstrap How to write split lines on bootstrap Apr 07, 2025 pm 03:12 PM

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

How to insert pictures on bootstrap How to insert pictures on bootstrap Apr 07, 2025 pm 03:30 PM

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

How to set up the framework for bootstrap How to set up the framework for bootstrap Apr 07, 2025 pm 03:27 PM

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

How to use bootstrap button How to use bootstrap button Apr 07, 2025 pm 03:09 PM

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

How to resize bootstrap How to resize bootstrap Apr 07, 2025 pm 03:18 PM

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

See all articles