• 카테고리

    질문 & 답변
  • 세부 분야

    프론트엔드

  • 해결 여부

    미해결

css가 이상합니다.

20.01.26 16:28 작성 조회수 195

2

<template>
<div class="inputBox shadow">
<input type="text" v-model="toDoItem" v-on:keyup.enter="addItem">
<span class="addContainer" v-on:click="addItem">
<i class="fas fa-plus addBtn"></i>
</span>
</div>
</template>

<script>
export default {
data: function() {
return {
toDoItem: ''
}
},
methods: {
addItem: function() {
localStorage.setItem(this.toDoItem, this.toDoItem)
this.cleanInput();
},
cleanInput: function() {
this.toDoItem = '';
}
}
}
</script>

<style scoped>
input:focus {
outline: none;
}
.inputBox {
background: white;
height:50px;
line-height: 50px;
border-radius: 5px;
}
.inputBox input {
border-style:none;
font-size: 0.9rem;
}
.addContainer {
float: right;
background: linear-gradient(to right, #6478FB, #8763FB);
display:block;
width: 3rem;
border-radius: 0 5px 5px 0;
}
.addBten {
color: white;
vertical-align: middle;
}
</style>

모두 똑같이 했는데 인풋이 들어가는 곳이 왼쪽이 아닌 가운데에 있는데 이게 body에 text-align:cener; 로 되어 있어서 그런 것 같은데 이걸 지우면 font icon plus도 가운데가 안되서 위치가 이상해집니다. 

코드가 분명히 똑같은데 왜 input 타입하는 곳이 가운데서 시작하고 input 크기가 작습니다. 

답변 2

·

답변을 작성해보세요.

1

linux-s님의 프로필

linux-s

질문자

2020.01.26

App.vue 코드도 올립니다

<template>
<div id="app">
<TodoHeader></TodoHeader>
<TodoInput></TodoInput>
<TodoList></TodoList>
<TodoFooter></TodoFooter>
</div>
</template>

<script>
import TodoHeader from './components/TodoHeader.vue'
import TodoInput from './components/TodoInput.vue'
import TodoList from './components/TodoList.vue'
import TodoFooter from './components/TodoFooter.vue'

export default {
components: {
'TodoHeader': TodoHeader,
'TodoInput' : TodoInput,
'TodoList' : TodoList,
'TodoFooter' : TodoFooter
}
}
</script>

<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}

body {
background-color: #F6F6F6;
}
input {
border-style: groove;
width:200px;
}
button {
border-style: groove;
}
.shadow {
box-shadow: 5px 10px 10px rgba(0, 0, 0, 0.03);
}
</style>

0

안녕하세요 창석님, 질문 주신 내용은 App.vue에서 인풋 박스의 너비가 200px로 설정되어 있어서 그렇습니다 :)