Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [HTML][CSS] unikanie przełamania kolumny
stellatus
post 24.01.2020, 23:42:11
Post #1





Grupa: Zarejestrowani
Postów: 196
Pomógł: 0
Dołączył: 9.03.2017

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


Kod
<style>
.multicol {
  background-color: beige;
  padding: 10px;

  /* Safari and Chrome */
  -webkit-column-count: 3;
  -webkit-column-rule: 2px dotted olivedrab;

  /* Firefox */
  -moz-column-count: 3;
  -moz-column-rule: 2px dotted olivedrab;

  /* CSS3 */
  column-count: 3;
  column-rule: 2px dotted olivedrab;
}

.multicol hr {
  break-after: column;
}

</style>
<div class="multicol">
  <h3>Legs</h3>
  <p>The key is to use good form, and not to over train your muscles. You need to let your muscles rest in between workouts. Give them 3 or 4 days to rest before training them again. Follow up each workout with a protein shake and your legs will never be the same.</p>
  <hr>
  <h3>Chest</h3>
  <p>Your chest muscles are a large part of your upper body. To achieve maximum results, your chest workout routine should include at least one compound exercise (to work your overall chest) followed as well as a more concentrated exercise. You can also single out either your upper chest or your lower chest if you need to.</p>
  <h3>Chest</h3>
  <p>Your chest muscles are a large part of your upper body. </p>
  <h3>Chest</h3>
  <p>Your chest muscles are a large part of your upper body. To achieve maximum results, your chest workout routine should include at least one compound exercise (to work your overall chest) followed as well as a more concentrated exercise. You can also single out either your upper chest or your lower chest if you need to.</p>
    <h3>Chest</h3>
  <p>Your chest muscles are a large part of your upper body. To achieve maximum results, your chest workout routine should include at least one compound exercise (to work your overall chest) followed as well as a more concentrated exercise. You can also single out either your upper chest or your lower chest if you need to.</p>
    <h3>Chest</h3>
  <p>Your chest muscles are a large part of your upper body. To achieve maximum results, your chest workout routine should include at least one compound exercise (to work your overall chest) followed as well as a more concentrated exercise. You can also single out either your upper chest or your lower chest if you need to.</p>
</div>


Jak to zrobić, żeby h3 nie zostawały same, gdy przełamywana jest kolumna, tylko żeby były przenoszone do następnej kolumny?



Próbowałem:

Kod
h3 {
    break-after: avoid;
    break-inside: avoid;
}


ale to nie działa.
Go to the top of the page
+Quote Post
trueblue
post 25.01.2020, 07:59:07
Post #2





Grupa: Zarejestrowani
Postów: 6 761
Pomógł: 1822
Dołączył: 11.03.2014

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


Nie działa, bo nagłówek i treść to osobne elementy. Opakuje razem w jakiś kontener.


--------------------
Go to the top of the page
+Quote Post
stellatus
post 25.01.2020, 11:57:07
Post #3





Grupa: Zarejestrowani
Postów: 196
Pomógł: 0
Dołączył: 9.03.2017

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


Dzięki. A nie ma żadnego polecenia w stylu: "nie łam kolumny w tym miejscu"?
Go to the top of the page
+Quote Post
trueblue
post 25.01.2020, 12:54:07
Post #4





Grupa: Zarejestrowani
Postów: 6 761
Pomógł: 1822
Dołączył: 11.03.2014

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


Nie ma. Bo po co(?)


--------------------
Go to the top of the page
+Quote Post
stellatus
post 25.01.2020, 23:09:40
Post #5





Grupa: Zarejestrowani
Postów: 196
Pomógł: 0
Dołączył: 9.03.2017

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


Bo tak łatwiej byłoby napisać skrypt JS. Potrzebne mi jest coś takiego do tego projektu: https://codepen.io/rudolph-reti/pen/povYZmP
Czyli ten sposób z opakowaniem w kontenery byłby Twoim zdaniem najprostszy?
Go to the top of the page
+Quote Post
trueblue
post 26.01.2020, 08:05:37
Post #6





Grupa: Zarejestrowani
Postów: 6 761
Pomógł: 1822
Dołączył: 11.03.2014

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


Jeśli nagłówek i wpisy będą osobnymi elementami względem rodzica, który ma kolumny to nie unikniesz przypadku kiedy obydwa znajdą się w odrębnych kolumnach.
Tak, tylko kontener.


--------------------
Go to the top of the page
+Quote Post
stellatus
post 26.01.2020, 21:09:14
Post #7





Grupa: Zarejestrowani
Postów: 196
Pomógł: 0
Dołączył: 9.03.2017

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


Dzięki bardzo.
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: 18.04.2024 - 11:50