A Responsive UI is a user interface that is adjustable on all devices. We can check the responsiveness of a website by changing the browser view size. Here we will discuss the responsiveness of a web page.
CSS3 Flexible layout is used to design flexible responsive layouts for different devices. We can easily design a website with different views by using CSS3 display: flex property.
<style>
.tdb-flex{
display:flex;
}
</style>
<body>
<div class="tdb-height">
<div class="tdb-div1">DIV1</div>
<div class="tdb-div2">DIV2</div>
</div>
</body>
Note: You can also use Grid Layout for responsive web designs.
<!DOCTYPE html>
<html>
<head>
<style>
.tdb-flex{
display:flex;
color:white;
padding:10px;
text-align:center
}
.tdb-div1{background-color:red;
width:50%}
.tdb-div2{background-color:black;
width:50%}
</style>
</head>
<body>
<div class="tdb-flex">
<div class="tdb-div1">DIV1</div>
<div class="tdb-div2">DIV2</div>
</div>
</body>
</html>
These are the properties we use for a flexible layout.
<style>
.tdb-flex{
display:flex;
flex-direction: column;
}
</style>
Note: You can also use Grid Layout for responsive web designs.
<!DOCTYPE html>
<html>
<head>
<style>
.tdb-flex{
display:flex;
padding:10px;
text-align:center;
flex-direction: column;
}
.tdb-div1,.tdb-div3{background-color:pink;
width:50%}
.tdb-div2{background-color:orange;
width:50%}
</style>
</head>
<body>
<div class="tdb-flex">
<div class="tdb-div1">DIV1</div>
<div class="tdb-div2">DIV2</div>
<div class="tdb-div3">DIV3</div>
</div>
</body>
</html>