Tag Archive for text

CSS3 Shadow properties

/* X Y Size Color */
-webkit-box-shadow: 10px 10px 25px #ccc;
-moz-box-shadow: 10px 10px 25px #ccc;
box-shadow: 10px 10px 25px #ccc;

text-shadow: 2px 2px 5px #ccc;

source

Vertical align text in floating div using css

HTML:
<div class="contentdiv">
<p>It works! Vertically Center Align!</p>
</div>

CSS:
.contentdiv{ width: 135px; height: 84px; display: table; border:2px solid red;}
.contentdiv p{ display: table-cell; vertical-align: middle; text-align: center;}

Hack for ie:
.contentdiv p{*margin-top: expression(this.offsetHeight < this.parentNode.offsetHeight ? parseInt((this.parentNode.offsetHeight - this.offsetHeight) / 2) + "px" : "0");}

source

Convert special characters to normal

$ts = array("/[À-Å]/","/Æ/","/Ç/","/[È-Ë]/","/[Ì-Ï]/","/Ð/","/Ñ/","/[Ò-ÖØ]/","/×/","/[Ù-Ü]/","/[Ý-ß]/","/[à-å]/","/æ/","/ç/","/[è-ë]/","/[ì-ï]/","/ð/","/ñ/","/[ò-öø]/","/÷/","/[ù-ü]/","/[ý-ÿ]/");
$tn = array("A","AE","C","E","I","D","N","O","X","U","Y","a","ae","c","e","i","d","n","o","x","u","y");
preg_replace($ts,$tn, $p);

source

Grep for files that do not match a pattern

grep -L "the pattern" *

# to recurse into subdirectories

grep -RL "the pattern" *

source

How to give text shadow using css

Here is a simple way to give shadow to a text using css.

HTML:
<div id="wrapper">
<span class="firstlayer">Text with shadow using CSS</span>
<span class="secondlayer">Text with shadow using CSS</span>
</div>

CSS:
.firstlayer {
font-size: 18px;
font-weight: bold;
color: #aa0000;
position: absolute;
top: 120px;
left: 20px;
z-index: 1;
}
.secondlayer {
font-size: 18px;
font-weight: bold;
color: #aaa;
position: absolute;
top: 122px;
left: 22px;
z-index: 0;
}

source

Show input Text while tipping

$('input#ID').keyup(function(){
$('div-where-the-text-will-show').text($(this).val());
});

source

limitChars

$('#message').keyup(function(){
limitChars('message', 160, 'charlimitinfo');
});

// The Function

function limitChars(textid, limit, infodiv)
{
var text = $('#'+textid).val();
var textlength = text.length;
if(textlength > limit)
{
$('#' + infodiv).html('You cannot write more then '+limit+' characters!');
$('#'+textid).val(text.substr(0,limit));
return false;
}
else
{
$('#' + infodiv).html(''+ (limit - textlength) +'');
return true;
}
}

source

AS3 Dynamic text bold format

var boldText:TextFormat = new TextFormat();
with (boldText) {
//font = "Verdana";
//size = 9.8;
//color = 0x000000;
bold = true;
}

my_textfield_txt.setTextFormat(boldText);

source

Embed Font From Library

var embeddedFontsArray: Array = Font.enumerateFonts(false);
for (var i:uint = 0; i < embeddedFontsArray.length; i++)
{
trace("fontName: " + embeddedFontsArray[i].fontName);
}

var t:TextField = new TextField();
addChild(t);

var tf:TextFormat = new TextFormat();
tf.font = "Verdana";
tf.size = 14;

t.embedFonts = true;
t.defaultTextFormat = tf;
t.antiAliasType = AntiAliasType.ADVANCED;
t.text = "Verdana";
t.autoSize = TextFieldAutoSize.LEFT;

stop();

source

String aleatoreo

Public Shared Function TextoAleatorio(Optional ByVal largoMinimo As Int16 = 1, Optional ByVal largoMaximo As Int16 = Int16.MaxValue) As String
Dim i As Integer
Dim largo As Integer = NumeroAleatorio(largoMaximo, largoMinimo)
Dim strTemp As New StringBuilder(largo)
For i = 0 To largo - 1
strTemp.Append(Chr(NumeroAleatorio(maximo:=90, minimo:=65)))
Next
Return strTemp.ToString()
End Function

source