0

Does anybody have any ideas on how to make the same way of proportional scaling but with initial height value instead of width.

#container {
    position: absolute;

    width: 50px;

    top: 10px;
    left:10px;

    background-color: blue;
}

#container:before {
    content:"";
    display:block;
    padding-top: 100%;
}

The above code in a fiddle

Martin
  • 621
  • 7
  • 16
  • 2
    Could you please elaborate a bit more on what it is that you're trying to achieve? Your question is currently vague. – Etheryte Feb 15 '14 at 20:13
  • Ok: The above css snippet is giving a div with a specific width, the same height, so its becoming a square. I want the same but the other way round: you can see the result in the fiddle – Martin Feb 15 '14 at 20:23
  • Fiddle is updated! Was my first time using it and i forgot to update the link! – Martin Feb 15 '14 at 20:24
  • Note that your current fiddle doesn't work in Chrome. Could you explain what it is that you're trying to create in general, it looks like you're building a workaround. – Etheryte Feb 15 '14 at 20:42
  • i to giv a div a specific height like 100% and let the width be the same amount of pixels, so that it will be a square. BUT I don't know how many pixels the height will be. Thats why % – Martin Feb 15 '14 at 21:45
  • No its not duplicate because i want it the other way round. I reall was looking a lot for a answer but i only found this way of doing aspect ratio... – Martin Feb 15 '14 at 22:15
  • The second half of the linked question's accepted answer covers your question. – Etheryte Feb 15 '14 at 22:21
  • @Nit I hope you don't mind me nitpicking, but the question doesn't have an accepted answer. – Mr Lister Feb 16 '14 at 12:41

0 Answers0