22.0404 week i learned

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
      integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
        integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
        crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
        integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
        crossorigin="anonymous"></script>

<title>스파르타코딩클럽 | 부트스트랩 연습하기</title>

<!--구글폰트 불러들이기-->
<link href="https://fonts.googleapis.com/css2?family=Jua&display=swap" rel="stylesheet">
<!--head에 스타일 입력하기-->
<style>
    /*폰트선택 https://fonts.google.com/?subset=korean*/
    * {
        font-family: 'JUA', sans-serif;
    }


    /*아이템 이미지 스타일*/
    .item-img {
        width: 500px;
        height: 500px;

        background-image: url("https://i.pinimg.com/736x/92/40/69/9240692ffd2891d10b695336fccfdeb8.jpg");
        background-position: center;
        background-size: cover;
    }

    /*아이템 디스크립션 스타일*/
    .item-desc {
        width: 500px;
        /*여백*/
        margin-top: 20px;
        margin-bottom: 20px;
    }

    /*아이템 디스크립션 중 가격 스타일*/
    .price {
        font-size: 15px;
        color: crimson;
    }

    /*아이템 주문창 스타일*/
     .item-order {
        width: 500px;
    }

    /*아이템 주문하기 버튼 스타일*/
    .btn-order {
        width: 200px;
        /*margin 이랑 display 블락걸어야 가운데 정렬*/
        margin: auto;
        display: block;
    }

     /*wrap으로 묶은 부분 가운데 정렬*/
    .wrap {
        width: 500px;
        margin: auto;
    }

    .rate{
        color:blueviolet;
    }

</style>

    <!--자바스크립트-->
    <script>
        $(document).ready(function () {
            get_rate();
        });

    function get_rate(){
        $.ajax({
            type: "GET",
            url: "http://spartacodingclub.shop/sparta_api/rate",
            data: {},
            success: function (response) {
                let now_rate = response['rate'];
                $('#now-rate').text(now_rate);
                /*now_rate라는 변수에 no-rate라는 ID값을 입력한다는 의미*/
            }
        })
    }


        /*order 누르면 경고창*/
        function order() {
            alert('주문이 완료되었습니다!');
        }

    </script>
<!--아이텝 디스크립션-->
<div class="item-desc">
    <h1> STRAWBERRY 🍓 PIE <span class="price"> price:7,000KRW </span></h1>
    <p> LIMITED-TIME SPRING SEASON ITEM </p>
</div>

<!--ajax 사용하여 실시간으로 서버 데이터 불러오기-->
<!--span id값을 지정하여 그 값만 변화하도록-->
<p class="rate">달러-원 환율 : <span id="now-rate">1219.15</span></p>


<!--아이템 주문창-->
<div class="item-order">
    <div>
        <!--부트스트랩 Input group : https://getbootstrap.com/docs/4.0/components/input-group/-->
        <div class="input-group mb-3">
            <!--옵션1-->
            <div class="input-group-prepend">
                <span class="input-group-text" id="basic-addon1"> ★ Orderer </span>
            </div>
            <!--내용입력-->
            <input type="text" class="form-control" placeholder="주문자분 성함을 적어주세요" aria-label="NAME"
                   aria-describedby="basic-addon1">
        </div>
        <!--부트스트랩 Input group : Custom forms-->
        <div class="input-group mb-3">
            <!--옵션2-->
            <div class="input-group-prepend">
                <span class="input-group-text" for="inputGroupSelect01"> ★ Quantity </span>
            </div>
            <!--선택박스-->
            <select class="custom-select" id="inputGroupSelect01">
                <option selected>몇 개 필요하세요?</option>
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
            </select>
        </div>
        <div class="input-group mb-3">
            <!--옵션3-->
            <div class="input-group-prepend">
                <span class="input-group-text" id="basic-addon3"> ★ Address </span>
            </div>
            <!--내용입력-->
            <input type="text" class="form-control" placeholder="어디로 배송하면 될까요?" aria-label="address"
                   aria-describedby="basic-addon3">
        </div>
        <div class="input-group mb-3">
            <!--옵션4-->
            <div class="input-group-prepend">
                <span class="input-group-text" id="basic-addon4"> ★ Phone </span>
            </div>
            <!--내용입력-->
            <input type="text" class="form-control" placeholder="전화번호도 적어주세요!" aria-label="phone"
                   aria-describedby="basic-addon4">
        </div>
        <!--버튼입력-->
        <!--onclick="order()"로 자바스크립트 사용-->
        <!--btn-order로 head 부분에서 스타일 지정-->
        <!--class="btn ********" 로 먼저 버튼기본 스타일 지정 ex) class="btn btn-group-toggle" -->
        <div>
            <button type="button" onclick="order()" class="btn btn-primary btn-order"> ORDER </button>
        </div>

    </div>
</div>

좋은 웹페이지 즐겨찾기