Tag Archive for html

Selector for link tag with class

a.menu:link {color: black}

Selects:
<a class="menu" href="#">MenuItem</a>

source

XHTML 1.0 Strict Template (DOCTYPE, charset, stylesheet)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" media="all" href="" />
</head>
<body>
</body>
</html>

source

Dead Centre A DIV

body
{
margin: 0px
}

#horizon
{
color: white;
background-color: #0ff;
text-align: center;
position: absolute;
top: 50%;
left: 0px;
width: 100%;
height: 1px;
overflow: visible;
visibility: visible;
display: block
}

#content
{
position: absolute;
left: 50%;
width: 250px; /* Overall width of div */
height: 70px; /* Overall height of div */
top: -35px; /* half of the overall height */
margin-left: -125px; /* half of the overall width */
visibility: visible
}

source

add HTML tag to a string

var bits:Array = new Array();

function addHtmlTag(tf:MovieClip,indexStart:Number,indexEnd:Number,tag:String):String{
bits = new Array();
bits = getStringParts(tf,indexStart,indexEnd);
if(bits != undefined){
var newString:String = bits[0] + " <" + tag + ">" + bits[1] + " </" + tag + ">" + bits[2];
return newString;
}
}

function getStringParts(tf:MovieClip,indexStart:Number,indexEnd:Number):Array{
var wholeString:String = tf.htmlText;
var totalIndex:Number = wholeString.length;
bits.push(wholeString.substring(0,indexStart));
bits.push(wholeString.substring(indexStart,indexEnd));
bits.push(wholeString.substring(indexEnd,totalIndex));
//trace("bits: "+bits);
return bits;
}

// usage
// var newText:String = addHtmlTag(myTextField_mc, 0, 10, "b");

source

simple black border

style='border: 1px solid black;'

source

Google calendar embed

<iframe src="http://www.google.com/calendar/embed?height=600&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=GOOGLE_EMAIL_ADDRESS%40gmail.com&amp;color=%232952A3&amp;ctz=America%2FNew_York" style=" border-width:0 " width="800" height="600" frameborder="0" scrolling="no"></iframe>

source

Get Input Controls Name And Value In HTML Page

public static string GetInputControlsNameAndValueInPage(string strPage)
{
string strRegExPatten = "<s*input.*?names*=s*"(?<Name>.*?)".*?values*=s*"(?<Value>.*?)".*?>";
Regex reg = new Regex(strRegExPatten, RegexOptions.Multiline);
MatchCollection mc = reg.Matches(strPage);
string strTemp = string.Empty;
foreach (Match m in mc)
{
strTemp = strTemp + m.Groups["Name"].Value + "=" + m.Groups["Value"].Value + "&";
}
int n = strTemp.Length;
strTemp = strTemp.Remove(n - 1);
return strTemp;
}

source

Valid XHTML 1.1 Strict Flash Embed

<div>
<object type="application/x-shockwave-flash" data="header.swf" width="700" height="116">
<param name="movie" value="header.swf" />
<img src="header.gif" width="700" height="116" alt="header" />
</object>
</div>

source

MySQL Query to HTML Table

function _mysql_result_all($result, $tableFeatures="border='1'",$nodata="&nbsp;") {
$tableDebug .= "<!--Debugging output for SQL query-->

";
echo "<table $tableFeatures>

";
$noFields = mysql_num_fields($result);
echo "<tr>
";
for ($i = 0; $i < $noFields; $i++) {
$field = mysql_field_name($result, $i);
echo "	<th>$field</th>
";
}
while ($r = mysql_fetch_row($result)) {
echo "<tr>
";
foreach ($r as $column) {
echo "	<td>";
if ($column == NULL) {
echo "$nodata";
} else {
echo $column;
}
echo "</td>
";
}
echo "</tr>
";
}
echo "</table>

";
echo "<!--End debug from SQL query-->

";
return $tableDebug;
}

_mysql_result_all($result);

source

Give headings IDs

Find:
(<h[1-6])(>)(.+)(</h[1-6]>)
Replace:
$1 id="$3"$2$3$4

Turns
<h4>Foobar</h4>
into
<h4 id="Foobar">Foobar</h4>

source