Skocz do zawartości

net4game

Największy polski serwer RolePlay w GTA: San Andreas Multiplayer

Zdjęcie

Jak konwertować px - %?


  • Please log in to reply
4 odpowiedzi w tym temacie

#1 Tomasz_Mytlewski — 1 04/05/2014 - 18:31

Tomasz_Mytlewski
  • Gracz

Witam, tak jak w temacie, robię stronkę ale na px, a jak ktoś ma większy ekran to brzydko wygląda. Pytanie za 100 punktów, jak wygląda miara.

 

1px - x%

2px - x%

3px - x%

 

( i tak dalej.. )

 

Leca piwka.

 

 


  • Do góry
    • 0

#2 Kone — 2597 04/05/2014 - 18:44

Kone
  • Gracz
Procent jest pobierany z poprzedniego elementu. Nie ma przelicznika ile pikseli to tyle procent. Ogólnie nie polecam używać takiej metody, najlepsza jest definitywnie z użyciem pikseli. Zawsze możesz użyć @media w CSS i dostosować sobie do jakich wymiarów strona ma wyglądać tak, a do innych tak.

I, personally, dislike websites which have a % width for the main content area because of the inconsistency. It's best to use a pixel width of about 1000 pixels, maybe a bit less, for the whole website so that it will work for all resolutions.

As for elements inside the main content area, I tend to use percent widths because I don't really want to both with calculating the exact pixel values. The result is set in stone anyway because the thing that it's a percentage of is constant, as opposed to the monitor's resolution, which varies between users.

To sum it up: only use percentages when every user is going to get the same result because of a parent element having a fixed (pixel) width. Otherwise there will be inconsistencies in your design, making it so that you can't use any flashy images and the website may look ugly to users with giant / tiny monitors. If you are going to use percentage widths you simply have to test the website with different resolutions!

http://stackoverflow...vs-width-in-css
  • Do góry
    • -1

#3 jezusek — 352 04/05/2014 - 22:30

jezusek
  • Gracz

Kone się nie zna.


  • Do góry
    • 2

#4 Kone — 2597 04/05/2014 - 22:35

Kone
  • Gracz

Kone się nie zna.

Tak dokładnie, potwierdzone info.
  • Do góry
    • 1

#5 jezusek — 352 05/05/2014 - 01:28

jezusek
  • Gracz

Btw. zamiast pierdolić się z własnym CSSem, polecam Ci skorzystać z jakiegoś frameworka do CSS, polecam bootstrap.


  • Do góry
    • 0


Użytkownicy przeglądający ten temat: 1

0 użytkowników, 1 gości, 0 anonimowych