0
Can an element or several elements have both a width in % and a height in pixels to create a Responsive Website HTML and CSS ?
Hi, I have a Question to ask you. Question: Can an element or several elements have both a width in % and a height in pixels (or vice versa) to create a Responsive and adaptable Website in HTML and CSS? For example: .box { width: 50%; /* Box width in percentage */ height: 200px; /* Height of the box in pixels */ background-color: #f0f0f0; margin-bottom: 20px; } Because when I inquire I see information where I am told the opposite because sometimes it is necessary that certain elements have fixed sizes depending on certain situations and contexts. Thank you for taking your time to read my message.
2 Antworten
0
Yes an HTML element can adopt a width in percentage combined with a fixed height in pixels to ensure that your web elements like banners and menus are visually consistent while remaining flexible across different screens. However a fixed height can sometimes restrict content on smaller devices making thorough testing essential.
0
When you start code first think about a blank canvas.you have to mention the canvas size first.then what ever you draw(or anything) step by step you have to specify this point dimensions from where you are creating and how much space it will take.100% also you can read as full size.