-
글쓴이글
-
2021년 10월 15일 21:15 #17988
강인웅참가자1. 모든 div를 감싸는 container class에 width 500px을 주고
input width도 500px을 주면 border 때문에 튀어나오더라구요
그래서 결국 width를 496px로 맞췄는데 원래 이런 식으로 해결해야 되는 건가요? 아니면 근본적인 해결방법이 있을까요
2. send를 감싸는 박스의 크기를 줄이고 싶어서 height 픽셀에 조정을 주면
안에 들어있는 h2 'send' 는 div에 크기에 맞게 조정되는 것이 아니라 그대로입니다. 마진을 줄여줘서 가운데 수직정렬을 맞춰줬는데
h2를 아예 div에 핏하게 맞출 수는 없는 건가요? 개발자 도구로 보면 h2가 div를 튀어나오는데 이것도 일일이 개발자도구를 봐가면서
margin을 줄여주는 방법밖에는 없는 건가요? margin:auto를 h2에 줘도 그대로여서 방법이 있나 싶습니다!
2021년 10월 15일 21:16 #17989
강인웅참가자----------------------------------------------------------------html 소스 ------------------------------------------------------------------------------------
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style2.css">
<title>Document</title>
</head>
<body>
<div class="container">
<div>
<h1>contact us</h1>
</div>
<div>
<h3>Your Email</h3>
<form class="email-box">
<input type="email" value="email@example.com">
</form>
</div>
<div class="firla-box">
<div class="first-box">
<h3>First Name</h3>
<form>
<input type="text">
</form>
</div>
<div class="last-box">
<h3>Last name</h3>
<form>
<input type="text">
</form>
</div>
</div>
<div class="message-box">
<h3>Message</h3>
<form>
<input type="text">
</form>
</div>
<div class="rs-box">
<div class="radio-box">
<form>
<input type="radio">subscribe
</form>
</div>
<div class="send-box">
<h2>SEND</h2>
</div>
</div>
</div>
</body>
</html>------------------------------------------------------------------css 소스-------------------------------------------------------------------------------------
div {
box-sizing: border-box;
}.container {
width: 500px;
height: 500px;
margin: auto;
}.first-box {
float: left;
}.firla-box input {
width: 180px;
}.last-box {
float: left;
position: absolute;
right: 0;
}.message-box {
clear: both;
}.message-box > form > input {
height: 100px;
width: 496px;
padding: 0px;
}.radio-box {
float: left;
margin-top: 25px;
}.send-box {
float: left;
display: block;
position: absolute;
right: 0;
background: yellow;
width: 120px;
text-align: center;
top: 10px;
height: 50px;
}.send-box > h2 {
margin-top: 12px;
}.rs-box {
position: relative;
}.firla-box {
position: relative;
}.email-box > input {
width: 496px;
padding: 0px;
}2021년 10월 15일 23:27 #17994
codingapple키 마스터1은 박스에 box-sizing 옵션을 조절하거나 해봅시다
2는 마진 대신 상하 padding을 주면 될듯 합니다
-
글쓴이글
- 답변은 로그인 후 가능합니다.