Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [CSS] Wyśrodkowanie tekstu
Lion_87
post
Post #1





Grupa: Zarejestrowani
Postów: 850
Pomógł: 120
Dołączył: 15.02.2007
Skąd: Łódź

Ostrzeżenie: (10%)
X----


Witam.

Mam problem bo nie mogę wyśrodkować tekstu. Chodzi mi o tą cześć na samym dole. Lewa strona jest na górze a prawa na dole. Ja chciałbym aby byly oba te teksty buły na środku.



A tak w plikach:
  1. <div id=\"mydol\">
  2. <div id=\"mydol1\">
  3. <?
  4. ...
  5. ?>
  6. </div>
  7. <div id=\"mydol2\"><p align=\'center'>
  8. <b><font color=red>MY</font>mes = <?
  9. ...
  10. ?>
  11. </div>
  12. </div>


Kod
#mydol {
    clear: both;
        width: 700px;
    height: 25px;
    margin-left: auto;
    margin-right: auto;
  }
  
#mydol1 {
  background: transparent url(redprofil/tlo/mydol01.png) 0 0 no-repeat;
  width: 340px;
  height: 25px;
  float: left;
  }
  
#mydol2 {
  background: transparent url(redprofil/tlo/mydol02.png) 0 0 no-repeat;
  width: 360px;
  height: 25px;
  float: right;
  }


W jaki sposób wyśrodkować ten tekst?

Ten post edytował Lion_87 1.12.2008, 12:06:26
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 7)
zaaap
post
Post #2





Grupa: Zarejestrowani
Postów: 106
Pomógł: 0
Dołączył: 13.11.2008

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


A moze
Kod
<div id="mydol2" style="margin-left:auto; margin-right:auto;">
albo dopisz to w CSSie
Go to the top of the page
+Quote Post
wookieb
post
Post #3





Grupa: Moderatorzy
Postów: 8 989
Pomógł: 1550
Dołączył: 8.08.2008
Skąd: Słupsk/Gdańsk




Kod
#mydol1 {
  background: transparent url(redprofil/tlo/mydol01.png) 0 0 no-repeat;
  width: 340px;
  height: 25px;
  float: left;
text-align: right;
  }
  
#mydol2 {
  background: transparent url(redprofil/tlo/mydol02.png) 0 0 no-repeat;
  width: 360px;
  height: 25px;
  float: right;
text-align: left;
  }


--------------------
Go to the top of the page
+Quote Post
Lion_87
post
Post #4





Grupa: Zarejestrowani
Postów: 850
Pomógł: 120
Dołączył: 15.02.2007
Skąd: Łódź

Ostrzeżenie: (10%)
X----


Hmmm chodziło mi o uzyskanie takiego efektu



I taki uzyskuje korzystając z <tr>, <td>.... Chciałem się dowiedzieć czy bez tego na samym div da sie zribić?
Go to the top of the page
+Quote Post
wookieb
post
Post #5





Grupa: Moderatorzy
Postów: 8 989
Pomógł: 1550
Dołączył: 8.08.2008
Skąd: Słupsk/Gdańsk




Wiec mów ze chodzi o wycentrowanie w pionie...
da się..
Kod
#element
{
display: table-cell;
vertical-align: middle;
}

A tak wogóle to źle dałes diva z float: right;
Powinien być przed tym z float: left;.


--------------------
Go to the top of the page
+Quote Post
Lion_87
post
Post #6





Grupa: Zarejestrowani
Postów: 850
Pomógł: 120
Dołączył: 15.02.2007
Skąd: Łódź

Ostrzeżenie: (10%)
X----


Teraz to tak wygląda:



Kod
#mydol {
    clear: both;
  width: 700px;
    height: 25px;
    margin-left: auto;
    margin-right: auto;

  }
  
#mydol1 {
  background: transparent url(redprofil/tlo/mydol01.png) 0 0 no-repeat;
  width: 340px;
  height: 25px;
  float: left;
  display: table-cell;
  vertical-align: middle;
  }
  
#mydol2 {
  background: transparent url(redprofil/tlo/mydol02.png) 0 0 no-repeat;
  width: 360px;
  height: 25px;
  float: right;
  display: table-cell;
  vertical-align: middle;
  }
Go to the top of the page
+Quote Post
wookieb
post
Post #7





Grupa: Moderatorzy
Postów: 8 989
Pomógł: 1550
Dołączył: 8.08.2008
Skąd: Słupsk/Gdańsk




To sprobuje inne wartosci vertical-align. Jak to nie pomoze to dodaj padding-top


--------------------
Go to the top of the page
+Quote Post
Lion_87
post
Post #8





Grupa: Zarejestrowani
Postów: 850
Pomógł: 120
Dołączył: 15.02.2007
Skąd: Łódź

Ostrzeżenie: (10%)
X----


Super. Tak działa idealnie.

Kod
#mydol {
    clear: both;
  width: 700px;
    height: 25px;
    margin-left: auto;
    margin-right: auto;
  }
  
#mydol1 {
  background: transparent url(redprofil/tlo/mydol01.png) 0 0 no-repeat;
  width: 340px;
  height: 25px;
  float: left;
  padding-top: 4px;
  }
  
#mydol2 {
  background: transparent url(redprofil/tlo/mydol02.png) 0 0 no-repeat;
  width: 360px;
  height: 25px;
  float: right;
  padding-top: 4px;
  }


Dzięki wookieb
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 Aktualny czas: 21.08.2025 - 06:06