나머지값 알아서 영역 잡는 CSS

bunny.log·2022년 9월 8일
0

display : table

const Container = styled.div`
	width: 100%;
	display: table;
	.title {
		display: table-cell;
		width: 150px;
		height: 59px;
	}

	.content-text {
		height: 60px;
		display: table-cell;
	}
`;
  • 컨텐이너 div
    display : table;

  • 오른쪽 영역 설정 div
    display : table-cell;
    width:150px;

  • 왼쪽 영역 설정 div
    display : table-cell;

    넓이를 지정 안한 왼쪽 div는 남은 영역을 차지

display : flex

const GnbContain = styled.div`
	position: relative;
	width: 100%;
	height: 72px;
	display: flex;
	flex-direction: row;
	
	.logo {
		position: relative;
		height: 100%;
		width: 280px;
		display: flex;
	}

	.header-middle-box {
		height: 100%;
		flex: 1;
	}
`;
  • 컨테이너 div
    display: flex;
    flex-direction: row;
  • 오른쪽 영역 설정 div
    display: flex;
    width:280px;
  • 왼쪽 영역 설정 div
    flex:1;로 지정하면 넓이를 지정하지 않는 div는 나머지 영역을 차지 한다.
profile
나를 위한 경험기록

0개의 댓글