Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [CSS] Padding w DIVie
Forum PHP.pl > Forum > Przedszkole
david8213
Jak zrobić aby "text" był wycentrowany oraz aby na około zachować odległość np 5mm wkoło tekstu, oczywiście żeby nie zmieniać rozstawu tabeli


  1. <style>
  2.  
  3. body {margin: 0 auto;}
  4.  
  5. #glowny { widht:100%; height:100px; background-color: #32CD32; //margin-top: 40px; //padding: 14px 11.4px;}
  6.  
  7.  
  8.  
  9. .columna1 {width:10%; background-color: #32ffff; float:left; height:auto; }
  10. .columna2 {width:40%; background-color: red; float:right; height:auto; //text-align: justify; }
  11. .columna3 {width:40%; background-color: grey; float:left; height:auto; //text-align: justify;}
  12. .columna4 {width:10%; background-color: yellow; float:right; height:auto; }
  13.  
  14. </style>
  15.  
  16. <body>
  17. <div id="glowny">
  18. <div class="columna1">11111</div> <div class="columna3"> tytuł <br><br>tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, tekst, <img src="ddd.jpg"> </div>
  19. <div class="columna4">222222</div> <div class="columna2">uuuuuu</div>
  20.  
  21.  
  22.  
  23.  
  24. <br><br><div style="clear:both;"></div> <br><br>
  25.  
  26. <div class="columna1">AAAAA</div> <div class="columna3">zzzzzzzzz11</div>
  27. <div class="columna4">BBBBB</div> <div class="columna2">yyyyyy</div>
  28.  
  29. </div>
  30.  
  31.  
  32. </body>
mrk9109
text-algin: center; dla kolumny numer 3 i usuń ?//?
david8213
głownie chodziło mi o odstępy w okół tekstu np po 5mm w koło tekstu. coś z padding: 14px 11.4px; nie wchodzi
trueblue
Kod
div{
display: flex;
align-items: center;
justify-content: center;
padding: 5mm;
}


lub

Kod
div{
display: table-cell;
text-align:center;
vertical-align:middle;
padding: 5mm;
}
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.