Maintain the aspect ratio of a div with CSS

0 votes

I want to make a div that can alter in width and height in response to the width of the window.

Exist any CSS3 guidelines that would permit the height to adjust to the width while preserving the aspect ratio?

Although I can accomplish this with JavaScript, I would rather use CSS alone.

div keeping aspect ratio according to width of window

Aug 19 in CSS by Edureka
• 11,040 points
22 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In CSS

0 votes
1 answer
0 votes
1 answer

when declaring css styles, what is the meaning of .classA.classB (two class names with a dot in the middle and no space)

The first example (space-separated classes) is a ...READ MORE

answered Jun 28 in CSS by Edureka
• 9,540 points
48 views
0 votes
1 answer

What is the proper way to display a logo with CSS?

An <img> element is the proper way ...READ MORE

answered Jun 10 in CSS by Edureka
• 9,540 points
40 views
0 votes
1 answer

CSS: Set a background color which is 50% of the width of the window

You can make a hard distinction instead ...READ MORE

answered Jun 28 in CSS by Edureka
• 9,540 points
445 views
0 votes
0 answers

What is the default value of "position" attribute of a DIV?

I was just curious as to what ...READ MORE

Jul 4 in CSS by Edureka
• 11,040 points
75 views
0 votes
0 answers

highlighting the current page in a list of links using css / html

I am trying to amend a friend's ...READ MORE

Jul 25 in CSS by Edureka
• 11,040 points
38 views
0 votes
0 answers

Make a full screen CSS background image appear "behind" a mobile keyboard

I've set an HTML/CSS full-screen background image ...READ MORE

Jul 18 in CSS by Edureka
• 11,040 points
167 views
0 votes
2 answers

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

HI.. SQL is Structured Query Language, which is ...READ MORE

answered Aug 8, 2020 in PHP by anonymous
5,050 views
0 votes
1 answer

Using/Handling colon inside a JSF generated HTML element ID in CSS selector

Yes, you can.  Just Backslash (\) the colon.  Like ...READ MORE

answered Nov 14, 2018 in Others by DataKing99
• 8,240 points
1,732 views
0 votes
1 answer

What is a css selector and where is it used?

CSS Selector is a combination of element ...READ MORE

answered Nov 21, 2018 in Data Analytics by Kalgi
• 52,350 points
296 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP