Pubblicato il 22/02/15 - aggiornato il  | 2 commenti :

Casella di ricerca per Blogger con CSS3.

Come installare un motore di ricerca personalizzato e professionale con CSS3 in una sidebar di Blogger.
Blogger dà la possibilità di utilizzare un proprio widget per mostrare ai visitatori un motore di ricerca per il sito. Bisogna andare su Aggiungi un gadget > HTML/Javascript > Base > Casella di ricerca. Possiamo però optare per altre opzioni quali quella di usare il servizio di Google per i motori di ricerca, crearlo con Adsense per chi si sia registrato o anche realizzare un motore gratuito personalizzato.  

In realtà basta poco codice per la creazione di un motore di ricerca con cui si possono realizzare dei widget di ricerca originali. È anche possibile inserire il motore in un menù anche se non tutti i menù sono strutturati in modo da avere questa caratteristica.  

In questo articolo vedremo come creare da soli una casella di ricerca utilizzando gli effetti di transizione che ci vengono dalla tecnologia CSS3. Il motore avrà questo aspetto 

casella-ricerca-blogger

Credo sia inutile sottolineare come i colori scelti possano essere modificati a piacere seguendo le regole dei codici dei colori. Ho anche postato nel web una demo per testarne il funzionamento

demo casella ricerca
Per la sua installazione si va su Layout > Aggiungi un gadget > Base > HTML/Javascript e, in Sezioni del sito, si incolla questo codice

<style>
.webdesigntuts-workshop:before {
    background: #444;
    background: -webkit-linear-gradient(left, #151515, #444, #151515);
    background: -moz-linear-gradient(left, #151515, #444, #151515);
    background: -o-linear-gradient(left, #151515, #444, #151515);
    background: -ms-linear-gradient(left, #151515, #444, #151515);
    background: linear-gradient(left, #151515, #444, #151515);
    top: 192px;
}
.webdesigntuts-workshop:after {
    background: #000;
    background: -webkit-linear-gradient(left, #151515, #000, #151515);   
    background: -moz-linear-gradient(left, #151515, #000, #151515);   
    background: -o-linear-gradient(left, #151515, #000, #151515);   
    background: -ms-linear-gradient(left, #151515, #000, #151515);   
    background: linear-gradient(left, #151515, #000, #151515);   
    top: 191px;
}
.webdesigntuts-workshop form {
    background: #111;
    background: -webkit-linear-gradient(#1b1b1b, #111);
    background: -moz-linear-gradient(#1b1b1b, #111);
    background: -o-linear-gradient(#1b1b1b, #111);
    background: -ms-linear-gradient(#1b1b1b, #111);
    background: linear-gradient(#1b1b1b, #111);
    border: 1px solid #000;
    border-radius: 5px;
    box-shadow: inset 0 0 0 1px #272727;
    display: inline-block;
    font-size: 0px;
    padding: 20px;
    position: relative;
    z-index: 1;
}
.webdesigntuts-workshop input {
    background: #222;
    background: -webkit-linear-gradient(#333, #222);   
    background: -moz-linear-gradient(#333, #222);   
    background: -o-linear-gradient(#333, #222);   
    background: -ms-linear-gradient(#333, #222);   
    background: linear-gradient(#333, #222);   
    border: 1px solid #444;
    border-radius: 5px 0 0 5px;
    box-shadow: 0 2px 0 #000;
    color: #888;
    display: block;
    float: left;
    font-family: 'Arial', helvetica, arial, sans-serif;
    font-size: 13px;
    font-weight: 400;
    margin: 0;
    padding: 0 10px;
    height: 40px;
    text-shadow: 0 -1px 0 #000;
    width: 180px;
}
.ie .webdesigntuts-workshop input {   
}
.webdesigntuts-workshop input::-webkit-input-placeholder {
   color: #888;
}
.webdesigntuts-workshop input:-moz-placeholder {
   color: #888;
}
.webdesigntuts-workshop input:focus {
    -webkit-animation: glow 800ms ease-out infinite alternate;
    -moz-animation: glow 800ms ease-out infinite alternate;
    -o-animation: glow 800ms ease-out infinite alternate;
    -ms-animation: glow 800ms ease-out infinite alternate;
    animation: glow 800ms ease-out infinite alternate;
    background: #222922;
    background: -webkit-linear-gradient(#333933, #222922);
    background: -moz-linear-gradient(#333933, #222922);
    background: -o-linear-gradient(#333933, #222922);
    background: -ms-linear-gradient(#333933, #222922);
    background: linear-gradient(#333933, #222922);
    border-color: #393;
    box-shadow: 0 0 5px rgba(0,255,0,.2), inset 0 0 5px rgba(0,255,0,.1), 0 2px 0 #000;
    color: #efe;
    outline: none;
}
.webdesigntuts-workshop input:focus::-webkit-input-placeholder {
    color: #efe;
}
.webdesigntuts-workshop input:focus:-moz-placeholder {
    color: #efe;
}
.webdesigntuts-workshop button {
    background: #222;
    background: -webkit-linear-gradient(#333, #222);
    background: -moz-linear-gradient(#333, #222);
    background: -o-linear-gradient(#333, #222);
    background: -ms-linear-gradient(#333, #222);
    background: linear-gradient(#333, #222);
    -webkit-box-sizing: content-box;
    -moz-box-sizing: content-box;
    -o-box-sizing: content-box;
    -ms-box-sizing: content-box;
    box-sizing: content-box;
    border: 1px solid #444;
    border-left-color: #000;
    border-radius: 0 5px 5px 0;
    box-shadow: 0 2px 0 #000;
    color: #fff;
    display: block;
    float: left;
    font-family: 'Arial', helvetica, arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    margin: 0;
    padding: 0;
    height: 40px;
    line-height: 40px;
    position: relative;
    text-shadow: 0 -1px 0 #000;
    width: 80px;
}
.webdesigntuts-workshop button:hover,
.webdesigntuts-workshop button:focus {
    background: #292929;
    background: -webkit-linear-gradient(#393939, #292929);   
    background: -moz-linear-gradient(#393939, #292929);   
    background: -o-linear-gradient(#393939, #292929);   
    background: -ms-linear-gradient(#393939, #292929);   
    background: linear-gradient(#393939, #292929);
    color: #5f5;   
    outline: none;
}
.webdesigntuts-workshop button:active {
    background: #292929;
    background: -webkit-linear-gradient(#393939, #292929);
    background: -moz-linear-gradient(#393939, #292929);
    background: -o-linear-gradient(#393939, #292929);
    background: -ms-linear-gradient(#393939, #292929);
    background: linear-gradient(#393939, #292929);
    box-shadow: 0 1px 0 #000, inset 1px 0 1px #222;
    top: 1px;
}
@-webkit-keyframes glow {
    0% {
        border-color: #393;
        box-shadow: 0 0 5px rgba(0,255,0,.2), inset 0 0 5px rgba(0,255,0,.1), 0 2px 0 #000;
    }   
    100% {
        border-color: #6f6;
        box-shadow: 0 0 20px rgba(0,255,0,.6), inset 0 0 10px rgba(0,255,0,.4), 0 2px 0 #000;
    }
}
@-moz-keyframes glow {
    0% {
        border-color: #393;
        box-shadow: 0 0 5px rgba(0,255,0,.2), inset 0 0 5px rgba(0,255,0,.1), 0 2px 0 #000;
    }   
    100% {
        border-color: #6f6;
        box-shadow: 0 0 20px rgba(0,255,0,.6), inset 0 0 10px rgba(0,255,0,.4), 0 2px 0 #000;
    }
}
@-o-keyframes glow {
    0% {
        border-color: #393;
        box-shadow: 0 0 5px rgba(0,255,0,.2), inset 0 0 5px rgba(0,255,0,.1), 0 2px 0 #000;
    }   
    100% {
        border-color: #6f6;
        box-shadow: 0 0 20px rgba(0,255,0,.6), inset 0 0 10px rgba(0,255,0,.4), 0 2px 0 #000;
    }
}
@-ms-keyframes glow {
    0% {
        border-color: #393;
        box-shadow: 0 0 5px rgba(0,255,0,.2), inset 0 0 5px rgba(0,255,0,.1), 0 2px 0 #000;
    }   
    100% {
        border-color: #6f6;
        box-shadow: 0 0 20px rgba(0,255,0,.6), inset 0 0 10px rgba(0,255,0,.4), 0 2px 0 #000;
    }
}
@keyframes glow {
    0% {
        border-color: #393;
        box-shadow: 0 0 5px rgba(0,255,0,.2), inset 0 0 5px rgba(0,255,0,.1), 0 2px 0 #000;
    }   
    100% {
        border-color: #6f6;
        box-shadow: 0 0 20px rgba(0,255,0,.6), inset 0 0 10px rgba(0,255,0,.4), 0 2px 0 #000;
    }
}
</style>
<section class="webdesigntuts-workshop">
    <form action="search/" method="q">           
        <input type="s" name="q" placeholder="Cerca..." />               
        <button>Cerca</button>
    </form>
</section>

Si salva e si posiziona.
Fonte | Mediterran House Radio -


2 commenti :

  1. Risposte
    1. Si tratta di un codice di 6 anni fa e può darsi che adesso non sia più supportato da Blogger
      @#

      Elimina

Non inserire link cliccabili altrimenti il commento verrà eliminato. Metti la spunta a Inviami notifiche per essere avvertito via email di nuovi commenti.
Info sulla Privacy