19 mar 2015

Less i extend

Mamy podstawowy styl dla button powiedzmy taki:

.button {
  padding: 12px 20px;
  border: 0;
  border-radius: 10px;
  margin: 5px;
  box-shadow: 0 5px 0 black;
}

Chcemy zrobić następne buttony o kolorze blue i red, zamiast za każdym razem dodawać do każdego butona podstawowy styl można użyć &:extend
"extend" działa od wersji 1.4 lessa

Tworzymy style:

.button--red {
  &:extend(.button);   // pobranie podstawowych danych
  background: red;     // dodajemy kolor red, możemy dodać także i tak #c63c67 ale 
                       // i w ten sposób czyli przez ustawienie zmiennych @red-default:	#ff0000;
}
<button class="button">button</button>
<button class="button--red">button</button>
2 mar 2015

Trochę animacji w CSS3 - kafelki

Animacja "kafelków" w css3

Trochę css

.box-flip {
  width: 999px;
  height: 390px;

}

.box-flip .front {
  line-height: 194px;
  text-align: center;
  font-weight: bold;
  font-size: 40px;
  font-family: Helvetica, Arial, Verdana, sans-serif;
  color: #c6001f;
  border: 1px solid;

}

.box-flip .item {
  float: left;
  cursor: pointer;
}

.box-flip .item .row-item {
  -webkit-transform-style: preserve-3d;
  -moz-transform-style: preserve-3d;
  -o-transform-style: preserve-3d;
  -ms-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-transition: 0.6s -webkit-transform;
  -moz-transition: 0.6s -moz-transform;
  -o-transition: 0.6s -o-transform;
  -ms-transition: 0.6s -o-transform;
  transition: 0.6s transform;
  position: relative;
}

.box-flip .item:hover .row-item {
  -webkit-transform: rotateY(.5turn);
  -moz-transform: rotateY(.5turn);
  -o-transform: rotateY(.5turn);
  -ms-transform: rotateY(.5turn);
  transform: rotateY(.5turn);
}

.box-flip .item .row-item>.back {
  overflow: hidden;
  opacity: 0;
  -webkit-transform: scale(0.4) rotateY(0.5turn) translateZ(1px);
  -moz-transform: scale(0.4) rotateY(0.5turn) translateZ(1px);
  -o-transform: scale(0.4) rotateY(0.5turn) translateZ(1px);
  -ms-transform: scale(0.4) rotateY(0.5turn) translateZ(1px);
  transform: scale(0.4) rotateY(0.5turn) translateZ(1px);
  -webkit-transition: 0.4s .075s opacity, 0.2s -webkit-transform;
  -moz-transition: 0.4s .075s opacity, 0.2s -moz-transform;
  -o-transition: 0.4s .075s opacity, 0.2s -o-transform;
  -ms-transition: 0.4s .075s opacity, 0.2s -ms-transform;
  transition: 0.4s .075s opacity, 0.2s transform;
  display: block;
}

.box-flip .item .row-item>.back {
  display: none\9;
}

.box-flip .item:hover .row-item>.back {
  overflow: visible;
  opacity: 1;
  -webkit-transform: scale(1) rotateY(0.5turn) translateZ(1px);
  -moz-transform: scale(1) rotateY(0.5turn) translateZ(1px);
  -o-transform: scale(1) rotateY(0.5turn) translateZ(1px);
  -ms-transform: scale(1) rotateY(0.5turn) translateZ(1px);
  transform: scale(1) rotateY(0.5turn) translateZ(1px);
}

.box-flip .item:hover .row-item>.back {
  display: block\9;
}

.box-flip .item {
  -webkit-perspective: 1200px;
  -moz-perspective: 1200px;
  -o-perspective: 1200px;
  -ms-perspective: 1200px;
  perspective: 1200px;
  overflow: visible;
}

.box-flip div.back {
  display: none;
  position: absolute;
  left: 0;
  top: 0;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  background: #f7732f;
  z-index: 2;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.8);
  line-height: 194px;
  text-align: center;
}

.box-flip .box-a {
  width: 333px;
  height: 195px;
  margin-right: 2px;
  margin-bottom: 2px;
}

.box-flip .box-a .back {
  width: 333px;
  height: 195px;
}

.box-flip .box-b {
  width: 664px;
  height: 195px;
  margin-bottom: 2px;
}

.box-flip .box-b .back {
  width: 664px;
  height: 195px;
}

.box-flip .box-c {
  width: 333px;
  height: 194px;
  margin-right: 2px;
}

.box-flip .box-c .back {
  width: 333px;
  height: 194px;
}

.box-flip .box-d {
  width: 331px;
  height: 194px;
  margin-right: 2px;
}

.box-flip .box-d .back {
  width: 331px;
  height: 194px;
}

.box-flip .box-e {
  width: 331px;
  height: 194px;
}

.box-flip .box-e .back {
  width: 331px;
  height: 194px;
}
1 lut 2015

Wyłączenie intergracji SKYPE z telefonami na stronach

Często gęsto bywa tak że posiadamy na stronie numery telefonów i powiedzmy ktoś wchodzi na stronę ze skypem ustawionym na ingerencję w numery telefonów.
Wtedy przerabiane są wszystkie telefony na wygląd skypowy, jednym słowem wszystko się "rozjeżdża" 🙁

Wystarczy dodać w sekcji head dodać jedną linijkę kodu i mamy delikwenta z głowy:

<head>
<meta name="SKYPE_TOOLBAR" content="SKYPE_TOOLBAR_PARSER_COMPATIBLE" />
</head>
23 sty 2015

Tabele w RWD

Powiedzmy że posiadamy tabelę z rezerwacjami hotelowymi.
Jeżeli zmniejszymy rozdzielczość na wielkość znaczka pocztowego - powiedzmy 320px to nic nie będzie widać i tutaj z pomocą przychodzi CSS.
Poniższe rozwiązanie działa od IE8 no i oczywiście w nowych przeglądarkach 😉

Przykładowa a tak wygląda tabela.

<section class="reservation-box">
    <table class="table-reservation">
        <thead>
        <tr>
            <th>Nazwisko i imię</th>
            <th>Telefon</th>
            <th>Adres e-mail</th>
            <th>Liczba wizyt</th>
            <th>Data ostatniej rezerwacji</th>
        </tr>
        </thead>
        <tbody>
        <tr class="reservation-row-item">
            <td data-title="Nazwisko i imię">Pałczyński stefan</td>
            <td data-title="Telefon">14725836</td>
            <td data-title="Adres e-mail">palczynski.stefan@gmail.com</td>
            <td data-title="Liczba wizyt">0</td>
            <td data-title="Data ostatniej rezerwacji">nie odbyła się</td>
        </tr>
        <tr class="reservation-row-item">
            <td data-title="Nazwisko i imię">Miałczyński Cezary</td>
            <td data-title="Telefon">69522999</td>
            <td data-title="Adres e-mail">mcezik@tet.pl</td>
            <td data-title="Liczba wizyt">1</td>
            <td data-title="Data ostatniej rezerwacji">28 stycznia 2014</td>
        </tr>
        <tr class="reservation-row-item">
            <td data-title="Nazwisko i imię">Tomaczek Andrzej</td>
            <td data-title="Telefon">32999222</td>
            <td data-title="Adres e-mail">tomaczekandrzej@jawa.pl</td>
            <td data-title="Liczba wizyt">1</td>
            <td data-title="Data ostatniej rezerwacji">20 stycznia 2015</td>
        </tr>
        </tbody>
    </table>
</section>

Jak widać tabela jak tabela, wygląda normalnie ale pojawiło się coś w komórkach "data-title" - atrybuty, te same nazwy co w sekcji thead > th.

<tr class="reservation-row-item">
    <td data-title="Nazwisko i imię">Pałczyński stefan</td>
    <td data-title="Telefon">14725836</td>
    <td data-title="Adres e-mail">palczynski.stefan@gmail.com</td>
    <td data-title="Liczba wizyt">0</td>
    <td data-title="Data ostatniej rezerwacji">nie odbyła się</td>
</tr>