Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [CSS]float
cycofiasz
post 22.09.2008, 16:46:58
Post #1





Grupa: Zarejestrowani
Postów: 711
Pomógł: 127
Dołączył: 5.07.2008
Skąd: Łódź

Ostrzeżenie: (0%)
-----


Witam, mam kod

  1. <div id="header">
  2. <div style="width: 300px; float: left;">
  3. <a href="index.php"><img src="resources/logo.gif" /></a>
  4. </div>
  5. <div style="width: 600px; float: left;">
  6. <a href="index.php"><img src="resources/logo.gif"/></a>
  7. </div>
  8.  
  9. </div>


I jak zrobić, by ten div o id header zmieniał swoją wysokość zależnie od zawartości? Wiem że zadziała jeśli jemu też nadam float: left, ale czy nie da się jakoś inaczej?
Go to the top of the page
+Quote Post
_olo_1984
post 22.09.2008, 17:09:29
Post #2





Grupa: Zarejestrowani
Postów: 289
Pomógł: 77
Dołączył: 5.08.2006

Ostrzeżenie: (0%)
-----


height: auto;


--------------------
awake
Go to the top of the page
+Quote Post
cycofiasz
post 22.09.2008, 17:11:06
Post #3





Grupa: Zarejestrowani
Postów: 711
Pomógł: 127
Dołączył: 5.07.2008
Skąd: Łódź

Ostrzeżenie: (0%)
-----


Nie działa
Go to the top of the page
+Quote Post
hateman
post 22.09.2008, 19:00:51
Post #4





Grupa: Zarejestrowani
Postów: 86
Pomógł: 18
Dołączył: 28.04.2008
Skąd: Poznań

Ostrzeżenie: (0%)
-----


  1. <div id="header">
  2. <div style="width: 300px; float: left;">
  3. <a href="index.php"><img src="resources/logo.gif" /></a>
  4. </div>
  5. <div style="width: 600px; float: left;">
  6. <a href="index.php"><img src="resources/logo.gif"/></a>
  7. </div>
  8. <div style="clear: both;"></div>
  9. </div>
Go to the top of the page
+Quote Post
hiszpanespaniol
post 22.09.2008, 21:09:48
Post #5





Grupa: Zarejestrowani
Postów: 213
Pomógł: 39
Dołączył: 7.04.2008
Skąd: 3city

Ostrzeżenie: (0%)
-----


Cytat
jak zrobić, by ten div o id header zmieniał swoją wysokość zależnie od zawartości?


sposób działający we wszystkich czołowych przeglądarkach:

  1. #header {
  2. height: auto !important;
  3. height: 1px;
  4. min-height: 1px;
  5. }


edit:
musisz dodać jeszcze to:

  1. overflow: hidden;


Ten post edytował hiszpanespaniol 22.09.2008, 21:40:48


--------------------
Go to the top of the page
+Quote Post
cycofiasz
post 23.09.2008, 07:37:09
Post #6





Grupa: Zarejestrowani
Postów: 711
Pomógł: 127
Dołączył: 5.07.2008
Skąd: Łódź

Ostrzeżenie: (0%)
-----


Oczywiście na kochanym IE tylko nie działa
Go to the top of the page
+Quote Post
hiszpanespaniol
post 23.09.2008, 09:52:35
Post #7





Grupa: Zarejestrowani
Postów: 213
Pomógł: 39
Dołączył: 7.04.2008
Skąd: 3city

Ostrzeżenie: (0%)
-----


skoro pod ie nie działa, to dodaj kolejną definicję css:

  1. * html #header {
  2. overflow: visible;
  3. }


to jest dla ie6, bo pod 7 musi byc już dobrze.
mam nadzieję, że pomogłem

hateman też napisał coś o czym zapomniałem:

  1. .clear {clear: both}
  2.  
  3. <div class="clear"><!-- --></div>


musisz dać taki div na samym końcu, niestety innej rady nie znam gdy się stosuje float. komentarz w środku jest po to, aby div miał zerową wysokość w ie. Tym div'em może być np stopka albo coś

pozdrawiam

Ten post edytował hiszpanespaniol 23.09.2008, 09:59:24


--------------------
Go to the top of the page
+Quote Post
hateman
post 23.09.2008, 17:20:35
Post #8





Grupa: Zarejestrowani
Postów: 86
Pomógł: 18
Dołączył: 28.04.2008
Skąd: Poznań

Ostrzeżenie: (0%)
-----


mój wcześniej podany sposób musi działać
sprawdzałem u siebie :]

Może chcesz jakiś inny efekt uzyskać?
Teraz dwa obrazki są obok siebie a "header" jest rozszerzony (tak jak chciałeś)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 13.08.2025 - 22:32