Problem Solving

[CSS] Requirements Q16, Q17: Music, Tape

Isaac S. Lee 2023. 10. 12. 16:16

📌Requirements Q16


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #main {
            width: 500px;
            margin: 0px auto;
        }
        
        h1 {
            font-variant: small-caps;
        }
        
        .item {
            border: 1px solid #999;
            border-radius: 5px;
            margin-bottom: 5px;
            width: 350px;
            overflow: hidden;
        }
        
        .item input[type=radio] {
            display: none;
        }
        
        .item label {
            display: block;
            float: left;
            width: 150px;
            height: 130px;
            text-align: center;
            font-size: 3em;
            font-variant: small-caps;
            font-weight: bold;
            background-color: #eee;
            border-top-left-radius: 4px;
            border-bottom-left-radius: 4px;
            padding-top: 20px;
            cursor: pointer;
            position: relative;
            left: 0;
            top: 0;
            z-index: 1;
        }
        
        .item .disc {
            float: left;
            width: 150px;
            height: 150px;
            background-position: center center;
            background-repeat: no-repeat;
            background-size: 100% 100%;
            margin: 0px 20px;
        }
        
        .item::after {
            content: ' ';
            display: block;
            clear: both;
        }
        
        #disc1 {
            background-image: url(https://drive.google.com/uc?export=download&id=1H7TqYHv5NjRScP-8f9h1PsEZO3GWXiGH);
        }
        
        #disc2 {
            background-image: url(https://drive.google.com/uc?export=download&id=18x4nR3VoKA238TvGjC5qGscr2FIkmLCk);
        }
        
        #disc3 {
            background-image: url(https://drive.google.com/uc?export=download&id=1DIod4hb720iLUdT9EYW38-_l2-tGDN7g);
        }
        
        #disc4 {
            background-image: url(https://drive.google.com/uc?export=download&id=1ROrHcrpStIqZYusMlYXx73GGnIenrOSg);
        }
        
        input[type=radio]:checked+label {
            background-color: tomato;
            color: white;
        }
        
        input[type=radio]:checked+label+div {
            transition: all 1000s;
            transition-timing-function: linear;
            transform: rotate(300000deg);
        }
    </style>
</head>

<body>
    <div id="main">
        <h1>Music</h1>
        <div class="item">
            <input type="radio" name="rb" id="rb1">
            <label for="rb1">Play</label>
            <div class="disc" id="disc1"></div>
        </div>
        <div class="item">
            <input type="radio" name="rb" id="rb2">
            <label for="rb2">Play</label>
            <div class="disc" id="disc2"></div>
        </div>
        <div class="item">
            <input type="radio" name="rb" id="rb3">
            <label for="rb3">Play</label>
            <div class="disc" id="disc3"></div>
        </div>
        <div class="item">
            <input type="radio" name="rb" id="rb4">
            <label for="rb4">Play</label>
            <div class="disc" id="disc4"></div>
        </div>
    </div>
    <hr style="margin-top: 300px;">

    <textarea style="display: block; width: 500px; height: 500px; margin: 0px auto;">
<div id="main">
	<h1>Music</h1>
	<div class="item">
		<input type="radio" name="rb" id="rb1">
		<label for="rb1">Play</label>
		<div class="disc" id="disc1"></div>
	</div>
	<div class="item">
		<input type="radio" name="rb" id="rb2">
		<label for="rb2">Play</label>
		<div class="disc" id="disc2"></div>
	</div>
	<div class="item">
		<input type="radio" name="rb" id="rb3">
		<label for="rb3">Play</label>
		<div class="disc" id="disc3"></div>
	</div>
	<div class="item">
		<input type="radio" name="rb" id="rb4">
		<label for="rb4">Play</label>
		<div class="disc" id="disc4"></div>
	</div>
</div>		
</textarea>
</body>
</html>

 

📌Requirements Q17


<!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>Document</title>
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous">
    <style>
        body {
            background-color: #8FD1D8;
            ;
        }
        
        h1 {
            color: #4E4E4E;
            font-variant: small-caps;
            font-size: 3em;
        }
        
        #main {
            width: 569px;
            margin: 0px auto;
        }
        
        #tape {
            width: 569px;
            height: 359px;
            background-image: url('https://drive.google.com/uc?export=download&id=1t9GcMheIDCVaZ6hBDRVXS-APLWtpT51J');
            position: relative;
            left: 0px;
            top: 0px;
        }
        
        #lefthole {
            position: absolute;
            left: 125px;
            top: 119px;
        }
        
        #righthole {
            position: absolute;
            left: 362px;
            top: 119px;
        }
        
        #lefthole,
        #righthole {
            animation: holeKey 1.25s infinite linear;
        }
        
        @keyframes holeKey {
            from {
                transform: rotate(0deg);
            }
            to {
                transform: rotate(360deg);
            }
        }
        
        #line {
            width: 133px;
            /* 176 */
            height: 64px;
            background-image: url('https://drive.google.com/uc?export=download&id=184-7uHoeAwMcxwrXO5m7FuVOq5BjkcIt');
            background-position: -50px 0px;
            position: absolute;
            left: 218px;
            top: 127px;
            animation: lineKey 1.5s infinite alternate linear;
        }
        
        @keyframes lineKey {
            from {
                background-position: -50px 0px;
            }
            to {
                background-position: 7px 0px;
            }
        }
    </style>
</head>

<body>
    <div id="main">
        <h1><i class="fas fa-headphones-alt"></i> Music</h1>
        <div id="tape">
            <img id="lefthole" src="https://drive.google.com/uc?export=download&id=1khKvAaDYt25voxiHJLFmnllSwfc7c8Iz">
            <img id="righthole" src="https://drive.google.com/uc?export=download&id=1khKvAaDYt25voxiHJLFmnllSwfc7c8Iz">
            <div id="line"></div>
        </div>
    </div>
    
    <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
    
    <h2 id="source" style="width:569px; margin-right: auto; margin-left: auto; display: block;">source code</h2>
    
    <textarea style="width:569px; height: 200px; margin-right: auto; margin-left: auto; display: block;">
<div id="main">
	<h1><i class="fas fa-headphones-alt"></i> Music</h1>
	<div id="tape">
		<img id="lefthole" src="images/tapehole.png">
		<img id="righthole" src="images/tapehole.png">
		<div id="line"></div>
	</div>
</div>		
	</textarea>
</body>
</html>