2.웹 메인 페이지 소스 정형화 하기

2024. 7. 1. 22:44카테고리 없음

웹 메인페이지 소스 정형화 하기

 

 

 

1.index.html

 

 

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Homepage</title>
    <link rel="stylesheet" href="style.css">
<script  src="http://code.jquery.com/jquery-latest.min.js"></script>
<link  rel="stylesheet"  href="http://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"/>
<script src="http://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
</head>
<body>
<script>
$(function(){
const swiper = new Swiper('.swiper', {
  // Optional parameters
  direction: 'horizontal',
  loop: true,
  autoplay: true,
  delay:1000,

  // If we need pagination
  pagination: {
el: '.swiper-pagination',
  },

  // Navigation arrows
  navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
  },

  // And if we need scrollbar
  scrollbar: {
el: '.swiper-scrollbar',
  },
});
});
</script>
    <header>
        <div class="container">
            <h1>Welcome to Our Website</h1>
            <nav>
                <ul>
                    <li><a href="#home">Home</a></li>
                    <li><a href="#about">About Us</a></li>
                    <li><a href="#services">Services</a></li>
                    <li><a href="#contact">Contact</a></li>
                </ul>
            </nav>
        </div>
    </header>
<!-- Slider main container -->
<div class="swiper">
  <!-- Additional required wrapper -->
  <div class="swiper-wrapper">
<!-- Slides -->
<div class="swiper-slide" style="background-image:url(https://via.placeholder.com/1920x500/FFEEFF);"></div>
<div class="swiper-slide" style="background-image:url(https://via.placeholder.com/1920x500/FFEEEE);"></div>
<div class="swiper-slide" style="background-image:url(https://via.placeholder.com/1920x500/EEFFEE);"></div>
...
  </div>
  <!-- If we need pagination -->
  <div class="swiper-pagination"></div>

  <!-- If we need navigation buttons -->
  <div class="swiper-button-prev"></div>
  <div class="swiper-button-next"></div>

  <!-- If we need scrollbar -->
  <div class="swiper-scrollbar"></div>
</div>
    <main>
        <section id="home" class="section">
            <div class="container">
                <h2>Home</h2>
                <p>Welcome to our homepage. We are glad to have you here. Explore our site to learn more about us and what we offer.</p>
            </div>
        </section>
        <section id="about" class="section">
            <div class="container">
                <h2>About Us</h2>
                <p>Our company is dedicated to providing the best service possible. We have a rich history and a bright future ahead.</p>
            </div>
        </section>
        <section id="services" class="section">
            <div class="container">
                <h2>Services</h2>
                <p>We offer a variety of services to meet your needs. Browse our services to find out how we can help you.</p>
            </div>
        </section>
        <section id="contact" class="section">
            <div class="container">
                <h2>Contact Us</h2>
                <p>Feel free to reach out to us with any questions or inquiries. We are here to help.</p>
            </div>
        </section>
    </main>
    <footer>
        <div class="container">
            <p>&copy; 2024 Our Website. All rights reserved.</p>
        </div>
    </footer>

</body>

</html>

 

 

 

 

2.style.css

 

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container {
    width: 80%;
    margin: auto;
    overflow: hidden;
}

header {
    background: #333;
    color: #fff;
    padding-top: 30px;
    min-height: 70px;
    border-bottom: #77d7c3 3px solid;
}

header a {
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 16px;
}

header ul {
    padding: 0;
    list-style: none;
}

header li {
    float: left;
    display: inline;
    padding: 0 20px 0 20px;
}

header nav {
    float: right;
    margin-top: 10px;
}

header #branding {
    float: left;
}

header #branding h1 {
    margin: 0;
}

.section {
    padding: 20px 0;
    border-bottom: #e8491d 1px solid;
}

footer {
    padding: 20px 0;
    background: #333;
    color: #fff;
    text-align: center;
}


.swiper {
  width: 100%;
 height:500px;
}
.swiper-slide {
  width: 100%;
 height:500px;
}

 

 

 

슬라이드를 swiper 슬라이드 사용 했는데....이부분을 다른 슬라이더도 사용 가능하게 할지 생각중