+ 1
[html, css] there is some problem in my code
so, there is one div element and one img in one row, and I can't center align the text in div element(there is p element inside div) and I want to make a div element and img the same size, but I can't. And please don't say use padding, because I want to make it responsive. BTW, the div element is smaller than the img element
5 odpowiedzi
+ 3
div{
height:200px;
width:200px;
background-color:blue;
display:flex;
align-items:center;
justify-content:center;
}
</style>
</head>
<body>
<div><p>hello</p></div>
+ 2
By giving both same heights?
+ 2
so you can also do same for height like 30% or whatever height for both?
+ 1
thanks, but do you know how to make div element to have the same height as img?
0
oh, I wanted to make it responsive, so I set the height as auto and width as 50%