Archive for the ‘Diseño’ Category

Emulate border in css font

January 11, 2016 Leave a comment

.my-font-with-border{text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;}


Simplify a fraction in Java

October 22, 2015 Leave a comment

import java.util.*;

* This method allows you to simplify a fraction
* @author grekz
* Sample input: 10 2
* Sample output: 5 1
class Solution {

public static void main(String args[]) {
Scanner in = new Scanner(;
int A = in.nextInt();
int B = in.nextInt();

int gcd = findGCD(A, B);
System.out.println( gcd > 1 ? (A/gcd) + " " + (B/gcd) : A + " " + B);
private static int findGCD(int number1, int number2) {
return number2 == 0 ? number1 : findGCD(number2, number1%number2);

Email template reset CSS styling

July 2, 2014 Leave a comment

            img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;}
            a img {border:none;}
            .image_fix {display:block;}
            #backgroundTable {margin:0; padding:0; width:100% !important; line-height: 100% !important;}
            /* Client-specific Styles */
            #outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */
            body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;}
            /* Prevent Webkit and Windows Mobile platforms from changing default font sizes, while not breaking desktop design. */
            .ExternalClass {width:100%;} /* Force Hotmail to display emails at full width */  
            .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} /* Force Hotmail to display normal line spacing. */
            #backgroundTable {margin:0; padding:0; width:100% !important; line-height: 100% !important;}
            /* End reset */
            p {
                margin: 1em 0;

Trigger select element (dropdown) in mobile browser, by clicking other element

May 19, 2014 Leave a comment

            var ele,evento;
		    evento= document.createEvent('MouseEvents');
			ele = document.querySelector("#show-dropdown-elements");

Obtener valor(option) de elemento select al cambiar – jQuery

August 5, 2011 11 comments

HTML de ejemplo

 <select id="mySelect">
    <option value="1">option A</option>
    <option value="2">option B</option>
<span id="iSelected">Hola</span>

jQuery para conseguir el option recien seleccionado:

    var $selectedOption = $(this).find('option:selected');
    var selectedLabel = $selectedOption.text();
    var selectedValue = $selectedOption.val();
    $('#iSelected').text(selectedValue + ' - ' + selectedLabel);

JsFiddle con el ejemplo

Cambiar el width de un input dependiendo de su entrada

July 20, 2011 Leave a comment

Hoy estaba mirando por la ventana, cuando repentinamente se me vino a la mente, jumm… por que no incrementar el ancho de un input dependiendo de la longitud de lo que se está escribiendo… entonces llegue a esto:

    onkeyup=" = this.value.length + 2 + 'ex';" 

Es importante también definir en tu CSS los tamaños máximos y mínimos del input, para que no desaparesca ni tampoco cresca hasta el infinito de los infinitos

input{ min-width: 100px; max-width: 50ex;}

Y… pueden ver el ejemplo en jsfiddle

JavaScript simple form submit

July 20, 2011 Leave a comment

<form name="nombreForm" id="miFormulario">
<a href="#" onclick="document.nombreForm.submit()">oneWay</a> 
<a href="#" onclick="document.forms["miFormulario"].submit()">otherWay</a> 
<a href="#" onclick="document.forms[0].submit()">OMG3way?</a>  
Categories: JavaScript, Mini-tips, Web