
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
저장하는 박스?가 처음부터 나와 있는 것을 처음부터 숨길려면 어떤 명령어를 사용하는지,
css, jQurey중 어디를 건드려야 하는지 알려주시면 감사하겠습니다.
그리고 script type="module" 이기 때문에 동적으로 코드를 작성하는지 궁금합니다.

사이트 접속할 때 이렇게 나오는게 아닌

처음부터 안나오는걸 원합니다.
**추가로
모바일에서는 타이틀 이미지가 여백없이 만들려면 css를 어떻게 고치면 될까요?

아래는 전체 코드입니다.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>앨범</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<style>
@import url('https://fonts.googleapis.com/css2?family=Hahmlet:wght@100..900&display=swap');
* {
font-family: "Hahmlet", serif;
font-weight: 200;
}
.mytitle {
height: 300px;
color: white;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-image: url('https://images.unsplash.com/photo-1511992243105-2992b3fd0410?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80');
background-position: center;
background-size: cover;
}
.mytitle>button {
width: 200px;
height: 50px;
color: white;
background-color: transparent;
border-radius: 5px;
border: 2px dotted white;
margin-top: 20px;
}
.Cards {
width: 1200px;
margin: 30px auto 0px auto;
}
.Posting_box {
width: 500px;
margin: 30px auto 0px auto;
padding: 20px;
box-shadow: 0px 0px 3px 0px blue;
border-radius: 5px;
}
.Posting_box>.P_btn {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.P_btn>.btn-dark {
margin-right: 5px;
color: white;
background-color: rgb(12, 117, 222);
border: 1px solid rgb(12, 117, 222);
}
.P_btn>.btn-outline-dark {
color: rgb(12, 117, 222);
border: 1px solid rgb(12, 117, 222);
}
</style>
<script type="module">//import 사용을 위해 module를 사용
// Firebase SDK 라이브러리 가져오기
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.22.0/firebase-app.js";
import { getFirestore } from "https://www.gstatic.com/firebasejs/9.22.0/firebase-firestore.js";
import { collection, addDoc } from "https://www.gstatic.com/firebasejs/9.22.0/firebase-firestore.js";
import { getDocs } from "https://www.gstatic.com/firebasejs/9.22.0/firebase-firestore.js";
// Firebase 구성 정보 설정
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyAj0US0ScVDFDOC1LgwXr8-ebzt1DVIEGs",
authDomain: "dbforweb-p00001.firebaseapp.com",
projectId: "dbforweb-p00001",
storageBucket: "dbforweb-p00001.appspot.com",
messagingSenderId: "1051280595928",
appId: "1:1051280595928:web:f7446701dc8b4bba4070ad",
measurementId: "G-9JS6DPR460"
};
// Firebase 인스턴스 초기화
const app = initializeApp(firebaseConfig);
const db = getFirestore(app);
$("#posting_btn").click(async function () {
let image = $('#image').val()
let title = $('#title').val()
let content = $('#content').val()
let data = $('#date').val()
let doc = {
'image': image,
'title': title,
'content': content,
'date': date
};
await addDoc(collection(db, "albums"), doc);
alert('save complete')
window.location.reload()
})
$("#open_close").click(async function () {
$('#P_B').toggle()
})
//$(document).ready(function () {
$('#card').empty()
let url = "http://spartacodingclub.shop/sparta_api/seoulair";
fetch(url).then(res => res.json()).then(data => {
let 상태 = data['RealtimeCityAir']['row'][0]['IDEX_NM']
$('#msg').text(상태)
})
//})
let docs = await getDocs(collection(db, "albums"));
docs.forEach((doc) => {
let row = doc.data();
console.log(row);
let image = row['image']
let title = row['title']
let content = row['content']
let date = row['date']
let temp_html = `
<div class="col">
<div class="card h-100">
<img src="${image}"
class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">${title}</h5>
<p class="card-text">${content}</p>
</div>
<div class="card-footer">
<small class="text-body-secondary">${date}</small>
</div>
</div>
</div>`;
$('#card').append(temp_html)
});
</script>
</head>
<body>
<div class="mytitle">
<h1>앨범</h1>
<p>현재 서울의 미세먼지: <span id="msg"></span></p>
<button id="open_close">저장</button>
</div>
<div class="Posting_box" id="P_B">
<div class="form-floating mb-3">
<input type="email" class="form-control" id="image" placeholder="이미지">
<label for="floatingInput">이미지</label>
</div>
<div class="form-floating mb-3">
<input type="email" class="form-control" id="title" placeholder="제목">
<label for="floatingInput">제목</label>
</div>
<div class="form-floating mb-3">
<input type="email" class="form-control" id="content" placeholder="내용">
<label for="floatingInput">내용</label>
</div>
<div class="form-floating mb-3">
<input type="email" class="form-control" id="date" placeholder="날짜">
<label for="floatingInput">날짜</label>
</div>
<div class="P_btn">
<button id="posting_btn" type="button" class="btn btn-dark">저장</button>
<button type="button" class="btn btn-outline-dark">닫기</button>
</div>
</div>
<div class="Cards">
<div id="card" class="row row-cols-1 row-cols-md-4 g-4">
</div>
</div>
</body>
</html>
