課程
/前端開(kāi)發(fā)
/HTML/CSS
/星級(jí)評(píng)分原理和實(shí)現(xiàn)(下)
請(qǐng)問(wèn)這個(gè)教程有源代碼嗎?
2018-07-24
源自:星級(jí)評(píng)分原理和實(shí)現(xiàn)(下) 3-3
正在回答
講的非常精煉,是個(gè)好老師!可以先看一下“搭建可靠的mongoDB集群”
每段視頻的方法代碼不一樣吧。這是2-4的
<!DOCTYPE html>
<html lang="en">
<head>
? ?<meta charset="UTF-8">
? ?<meta name="viewport" content="width=device-width, initial-scale=1.0">
? ?<meta http-equiv="X-UA-Compatible" content="ie=edge">
? ?<title>星級(jí)評(píng)分-第四種實(shí)現(xiàn)方式</title>
? ?<style>
? ? ? ?.rating{
? ? ? ? ? ?position: relative;
? ? ? ? ? ?width: 580px;
? ? ? ? ? ?height: 116px;
? ? ? ? ? ?background: url(images/rating.png) repeat-x;
? ? ? ? ? ?margin: 100px auto;
? ? ? ? ? ?overflow: hidden;
? ? ? ?}
? ? ? ?/* 父容器鼠標(biāo)劃過(guò)時(shí),下面的a標(biāo)簽的樣式 */
? ? ? ?.rating:hover .rating-item{
? ? ? ? ? ?background-image: none;
? ? ? ?/* class以及偽類(lèi)多的css樣式優(yōu)先級(jí)比后面class以及偽類(lèi)少的css樣式優(yōu)先級(jí)高 */
? ? ? ?.rating-item:hover{
? ? ? ? ? ?background-image: url(images/rating.png) repeat-x 0 -116px !important;
? ? ? ?.rating input{
? ? ? ? ? ?position: absolute;
? ? ? ? ? ?left: 0;
? ? ? ? ? ?top: -30px;
? ? ? ?.rating-item{
? ? ? ? ? ?top: 0;
? ? ? ? ? ?z-index: 3;
? ? ? ? ? ?width: 116px;
? ? ? ?.rating-item-1{
? ? ? ?.rating-item-2{
? ? ? ? ? ?left: 116px;
? ? ? ?.rating-item-3{
? ? ? ? ? ?left: 232px;
? ? ? ?.rating-item-4{
? ? ? ? ? ?left: 348px;
? ? ? ?.rating-item-5{
? ? ? ? ? ?left: 464px;
? ? ? ? ? ?z-index: 2;
? ? ? ? ? ?background: url(images/rating.png) repeat-x -2px -116px;
? ? ? ?input:checked + .rating-item{
? ? ? ? ? ?z-index: 1;
? ? ? ?input:checked .rating-item ~ .rating-item:hover{
? ? ? ? ? ?z-index: 0;
? ? ? ?.rating-item-1:hover,.rating-1:checked + .rating-item{
? ? ? ?.rating-item-2:hover,.rating-2:checked + .rating-item{
? ? ? ? ? ?width: 232px;
? ? ? ?.rating-item-3:hover,.rating-3:checked + .rating-item{
? ? ? ? ? ?width: 348px;
? ? ? ?.rating-item-4:hover,.rating-4:checked + .rating-item{
? ? ? ? ? ?width: 464px;
? ? ? ?.rating-item-5:hover,.rating-5:checked + .rating-item{
? ? ? ?.rating-item label{
? ? ? ? ? ?display: inline-block;
? ? ? ? ? ?/* 寬高完全取決于父容器 */
? ? ? ? ? ?width: 100%;
? ? ? ? ? ?height: 100%;
? ? ? ? ? ?cursor:pointer;
? ?</style>
</head>
<body>
? ?<form action="">
? ? ? ?<div class="rating">
? ?
? ? ? ? ? ?<input type="radio" name="rating" id="rating-1" value="1">
? ? ? ? ? ?<a href="#" class="rating-item rating-item-1" title="很不好"><label for="rating-1"></label></a>
? ? ? ? ? ?<input type="radio" name="rating" id="rating-2" value="2">
? ? ? ? ? ?<a href="#" class="rating-item rating-item-2" title="不好"><label for="rating-2"></label></a>
? ? ? ? ? ?<input type="radio" name="rating" id="rating-3" value="3">
? ? ? ? ? ?<a href="#" class="rating-item rating-item-3" title="一般"><label for="rating-3"></label></a>
? ? ? ? ? ?<input type="radio" name="rating" id="rating-4" value="4">
? ? ? ? ? ?<a href="#" class="rating-item rating-item-4" title="好"><label for="rating-4"></label></a>
? ? ? ? ? ?<input type="radio" name="rating" id="rating-5" value="5">
? ? ? ? ? ?<a href="#" class="rating-item rating-item-5" title="非常好"><label for="rating-5"></label></a>
? ? ? ? ? ?
? ? ? ?</div>
? ? ? ?<input type="button" value="submit">
? ?</form>
</body>
</html>
舉報(bào)
本課程主要講解如何使用不同的方式來(lái)實(shí)現(xiàn)星級(jí)評(píng)分的效果。
1 回答星星評(píng)價(jià)源碼可以分享嗎???
1 回答就我一個(gè)人看著代碼心塞嗎?
1 回答能不能把代碼貼出來(lái),以方便學(xué)習(xí)?
1 回答只能定位一次怎么辦,并不像老師那樣點(diǎn)擊第幾顆就定位第幾顆,感覺(jué)代碼也沒(méi)什么問(wèn)題呀
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢(xún)優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2022-03-24
講的非常精煉,是個(gè)好老師!可以先看一下“搭建可靠的mongoDB集群”
2018-08-12
每段視頻的方法代碼不一樣吧。這是2-4的
<!DOCTYPE html>
<html lang="en">
<head>
? ?<meta charset="UTF-8">
? ?<meta name="viewport" content="width=device-width, initial-scale=1.0">
? ?<meta http-equiv="X-UA-Compatible" content="ie=edge">
? ?<title>星級(jí)評(píng)分-第四種實(shí)現(xiàn)方式</title>
? ?<style>
? ? ? ?.rating{
? ? ? ? ? ?position: relative;
? ? ? ? ? ?width: 580px;
? ? ? ? ? ?height: 116px;
? ? ? ? ? ?background: url(images/rating.png) repeat-x;
? ? ? ? ? ?margin: 100px auto;
? ? ? ? ? ?overflow: hidden;
? ? ? ?}
? ? ? ?/* 父容器鼠標(biāo)劃過(guò)時(shí),下面的a標(biāo)簽的樣式 */
? ? ? ?.rating:hover .rating-item{
? ? ? ? ? ?background-image: none;
? ? ? ?}
? ? ? ?/* class以及偽類(lèi)多的css樣式優(yōu)先級(jí)比后面class以及偽類(lèi)少的css樣式優(yōu)先級(jí)高 */
? ? ? ?.rating-item:hover{
? ? ? ? ? ?background-image: url(images/rating.png) repeat-x 0 -116px !important;
? ? ? ?}
? ? ? ?.rating input{
? ? ? ? ? ?position: absolute;
? ? ? ? ? ?left: 0;
? ? ? ? ? ?top: -30px;
? ? ? ?}
? ? ? ?.rating-item{
? ? ? ? ? ?position: absolute;
? ? ? ? ? ?top: 0;
? ? ? ? ? ?z-index: 3;
? ? ? ? ? ?width: 116px;
? ? ? ? ? ?height: 116px;
? ? ? ?}
? ? ? ?.rating-item-1{
? ? ? ? ? ?left: 0;
? ? ? ?}
? ? ? ?.rating-item-2{
? ? ? ? ? ?left: 116px;
? ? ? ?}
? ? ? ?.rating-item-3{
? ? ? ? ? ?left: 232px;
? ? ? ?}
? ? ? ?.rating-item-4{
? ? ? ? ? ?left: 348px;
? ? ? ?}
? ? ? ?.rating-item-5{
? ? ? ? ? ?left: 464px;
? ? ? ?}
? ? ? ?.rating-item:hover{
? ? ? ? ? ?left: 0;
? ? ? ? ? ?z-index: 2;
? ? ? ? ? ?background: url(images/rating.png) repeat-x -2px -116px;
? ? ? ?}
? ? ? ?input:checked + .rating-item{
? ? ? ? ? ?left: 0;
? ? ? ? ? ?z-index: 1;
? ? ? ? ? ?background: url(images/rating.png) repeat-x -2px -116px;
? ? ? ?}
? ? ? ?input:checked .rating-item ~ .rating-item:hover{
? ? ? ? ? ?z-index: 0;
? ? ? ?}
? ? ? ?.rating-item-1:hover,.rating-1:checked + .rating-item{
? ? ? ? ? ?width: 116px;
? ? ? ?}
? ? ? ?.rating-item-2:hover,.rating-2:checked + .rating-item{
? ? ? ? ? ?width: 232px;
? ? ? ?}
? ? ? ?.rating-item-3:hover,.rating-3:checked + .rating-item{
? ? ? ? ? ?width: 348px;
? ? ? ?}
? ? ? ?.rating-item-4:hover,.rating-4:checked + .rating-item{
? ? ? ? ? ?width: 464px;
? ? ? ?}
? ? ? ?.rating-item-5:hover,.rating-5:checked + .rating-item{
? ? ? ? ? ?width: 580px;
? ? ? ?}
? ? ? ?.rating-item label{
? ? ? ? ? ?display: inline-block;
? ? ? ? ? ?/* 寬高完全取決于父容器 */
? ? ? ? ? ?width: 100%;
? ? ? ? ? ?height: 100%;
? ? ? ? ? ?cursor:pointer;
? ? ? ?}
? ?</style>
</head>
<body>
? ?<form action="">
? ? ? ?<div class="rating">
? ?
? ? ? ? ? ?<input type="radio" name="rating" id="rating-1" value="1">
? ? ? ? ? ?<a href="#" class="rating-item rating-item-1" title="很不好"><label for="rating-1"></label></a>
? ?
? ? ? ? ? ?<input type="radio" name="rating" id="rating-2" value="2">
? ? ? ? ? ?<a href="#" class="rating-item rating-item-2" title="不好"><label for="rating-2"></label></a>
? ?
? ? ? ? ? ?<input type="radio" name="rating" id="rating-3" value="3">
? ? ? ? ? ?<a href="#" class="rating-item rating-item-3" title="一般"><label for="rating-3"></label></a>
? ?
? ? ? ? ? ?<input type="radio" name="rating" id="rating-4" value="4">
? ? ? ? ? ?<a href="#" class="rating-item rating-item-4" title="好"><label for="rating-4"></label></a>
? ?
? ? ? ? ? ?<input type="radio" name="rating" id="rating-5" value="5">
? ? ? ? ? ?<a href="#" class="rating-item rating-item-5" title="非常好"><label for="rating-5"></label></a>
? ? ? ? ? ?
? ? ? ?</div>
? ? ? ?<input type="button" value="submit">
? ?</form>
</body>
</html>