HTML 学习杂记

代码范例

<?php
function testFunc1 () {
    echo 'testFunc1';
}
$b = 3;
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的第一个页面</title>
<script> 
    console.log("欢迎来到js的世界");
    function myFunction () {
        console.log("btn clicked");
    }
    function getInnerHTML() {
        // console.log(document.URL);
        // alert(document.getElementById("tr1").innerHTML);
        var t=document.getElementById("TestCode").value;
        console.log(t);
    }
</script>
<!-- 内部样式表
    <style type="text/css">
        body {background-color: red}
        p {margin-left: 20px}
    </style>
-->
<!--外部引入css文件-->
<link rel="stylesheet" type="text/css" href="/css/csstest1.css"/>
</head>
<body style="background-color:powderblue">
<h1>web开发教程</h1><!--h2尺寸的文本 可以添加对其方式 align="center" -->
<hr /><!--分隔线-->
<br /><!--换行-->

<ol start="1" type="1"><!--标签定义有序列表 start:规定有序列表的起始值  reversed:有序列表是降序的 type:规定在列表中使用的标记类型 1 A a I i-->
<li>内嵌php</li>
<p><!--段落 段落内换行使用 <br />-->
<?php $a=1; ?>
$a1 = <?php echo $a;?>
<?php $a++; ?>
$a2 = <?php echo $a;?>
$b = <?php echo $b;?>
$testFunc1 = <?php testFunc1();?>
</p>

<li>表格</li>
<table border="1" cellpadding="10" frame="void" summary="name list"><!--cellpadding:规定单元格之间的空白 frame:规定外侧边框的哪个部分是可见的 summary:摘要,视图不可见-->
<tr id="tr1">
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr id="tr2">
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>

<li>按钮</li>
<button type="button" ondblclick="myFunction()">点击这里</Button>

<li>input</li>
<input type="button" onclick="getInnerHTML()" value="Alert innerHTML of table row" />

<li>link</li>
<a id="url1" href="http://www.w3school.com.cn" title="w3school 跳转">wschool link</a>
<a href="http://www.w3school.com.cn" title="w3school 跳转">wschool link</a>

<li>textarea</li>
<textarea id="TestCode" wrap="logical">
textarea 测试
</textarea>

<li>文本格式化</li>
<b>bold </b> <strong>strong </strong> <big>big </big> <em>emphasized </em> <i>italic </i> <small>small </small> <sub>subscript </sub> <sup>superscript</sup> <ins>下横线(插入字)</ins> &nbsp; <del>删除字 </del><cite>引用</cite>

<li>保留字</li>
& nbsp; 空格  & lt; 小于号   & gt; 大于号   & quot; 引号   & copy; 版权符号   & amp; &符号

<li>计算机输出标签</li>
<code>Computer code定义计算机代码 </code> <kbd>Keyboard定义计算机输入  </kbd> <tt>Teletype打字机  </tt> <samp>Sample定义计算机输出代码样本  </samp><var>variable定义变量  </var>
<pre>
&lt;h1&gt;这是预格式文本 保留了      空格和换行&lt;/h1&gt;
pre 标签很适合显示计算机代码:
</pre>
<var>E</var> = <var>m</var> <var>c</var><sup>2</sup>

<li>地址</li>
<address>
Visit us at: Box 564, Disneyland USA
</address>

<li>缩写</li>
<abbr title="World Wide Web">www</abbr>
<dfn title="World Wide Web">www</dfn>
<acronym title="World Wide Web">www</acronym>

<li>文字方向右向左</li>
<bdo dir="rtl">我们</bdo>

<li>引用</li>
<blockquote>
这是长的引用。这是长的引用。这是长的引用。这是长的引用。这是长的引用。这是长的引用。这是长的引用。这是长的引用。这是长的引用。这是长的引用。这是长的引用。
</blockquote>
<q>这是短的引用。</q>

<li>图片链接</li>
<a href="http://www.baidu.com" target="_blank"><img boder="0" src="/img/img_championcup.png"/></a>
</ol>
</body>

css file 

li {color: black}
p {color: blue}
#url1:link {color:blue; text-decoration:none}
#url1:hover {color:red; text-decoration:none}
原文地址:https://www.cnblogs.com/pengyingh/p/6855407.html