html+css基礎,htmlcss

來源:互聯網
上載者:User

html+css基礎,htmlcss

完整的HTML結構

<!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>

<title></title>

</head>

<body>

</body>

</html>

 

   樣式的引用

  一。內部編寫

<head>

<title> </title>

<style type="text/css">

body {background:black; text-spacing:0.5em}

.div_css1 {align="center" margin:20px}

.p_css1 {color:red; font:(Style)itlic||oblique (variant)small-caps||none (weight)800(400=norml 700=bold) (size)4em (family)“宋體”||Times New Norman}

</style>

<div class="">

(if ues:   so use the style just 1 times)!!!

#div_css {}

<div id="">

(or ues:    so don't write"class or id =?" )

div.p {}

div p {}

二。外部參考

<link rel="stylesheet" type="text/css" href="xx.css">

 

 超連結的樣式

a {}         // all super links

a:link {}         //no linked links

a:visited{}           //alredy linked links

a:hover{}         //on mose move to the link 

a:action{}      // 點擊時

 

  插入flash檔案

<object type="application/x-shockwave-flash" date="///" width="" height="" id="">

<param name="movie" value="///"/>

<param name="allowscriptAcess" value="sameDomain"/>

<param name="quality" value="best"/>

<param name="bgcolor" value="#FFFFFF"/>

<param name="scale" value="noScale"/>

<param name="salign" calue="TL"/>

<param name="FlashVars" value="playerMode=embedded"/>

</object> 

                                               

  插入視頻

<object type="video/x-ms-wmv" date="////xx" width="" height="">

<param name="src" value="////xx"/>

<param name="autostart" value="true"/>

<param name="controller" value="true"/>

</object>

 

 插入網頁塊

<iframe 

src="xx"

width=""

height=""

scrolling="auto"

frameborder="o"

name="xx">

</iframe>

 

插入表單

<form action="#" name="" id="" method="post"> </form>

   

 一。文本輸入(帳號,密碼)

帳號<input type="text" name="" id="" maxlenth=""/>

密碼<input type="password" name="" id="" maxlenth=""/>

 

 二。提交表單

<input type="submit" name="" id="" value="確認"></input>

  

 三。單選

<input type="radio" name="" id="" value="xx">xx</input>

<input type="radio" name="" id="" value="xx">xx</input>

 

四。多選

<input type="checkbox" name="" id="" vslue="xx">xx</input>

<input type="checkbox" name="" id="" vslue="xx">xx</input>

<input type="checkbox" name="" id="" vslue="xx">xx</input>

 

 五。下拉式功能表

<select name="" id="">

<option vslue="xx">xx</option>

<option vslue="xx">xx</option>

<option vslue="xx">xx</option>

</select>

     

六。列表(沒有下拉)

<select name="" id="" size="個數">

<option value="">xx</optin>

.......

......

</select>

                                    

  懸浮文字框

<fieldset>

<legend>xx</legend>

</fieldset>

     

  滾動文字

<maquee direction="up || left" scrollamount="0-x" onmouseover="stop()" onmouseout="start()">

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

</marquee>    

 

 表格

<table>

<tr>

<td>xx</td>

</tr>

<tr>

<td colspan="num">xx</td>   //合并橫向

<td rowspan="num">xx</td>   //合并豎向

</tr>

</table>

 

 文字的一些屬性

設定元素內容的文字屬性

(1)舉例設定文本首行縮排

   text-indent:2em;

(2)舉例設定文本對齊

   text-align:left | right | center;

(3)舉例設定文本修飾方式

   text-decoration:underline;

(4)舉例設定字間距

   letter-spacing:2em;

(5)舉例設定詞間距

   word-spacing:0.5em;

(6)舉例空白顯示形式 P56

   white-space:pre;

外邊距margin:圍繞在元素邊框之外的可選地區。

內邊距padding:常值內容到邊框之間的可選地區

 

 元素浮動

浮動:

float

有2個方向: left  right none(不浮動)

對於文字浮動,必須設定高度,寬度,如果不設,後後果自負。

例

<img>position:absolute;  

絕對位置:相對於父級元素(被包含容器)。

position:relative; 

相對定位:相對於沒有設定position時的正常位置定位

原始空間會保留下來。(意思就是說按static的位置算的地方不會出現另外的標籤。如DIV,IMG等等。)

例子:

<head>

<style type="text/css">

.div_1 {width:150px;height:200px;}

.text1 {width:200px;height:100px;left:160px;}

</style>

</head>

<body>

<div>

<div class="div_1">解釋:“哈我是一個帥哥”用的是absolute 絕對位置,它相對於第一個DIV來定位,因為第一個DIV是它的父級元素,將它包含在裡面。所以它出現在頂部起頭。(因為沒對其設定left 和top等)

“是不是哦,我暈你”也是absolute 絕對位置,它相對於第一個DIV定位,設定了left值為160px,大於上一個div的寬度,所以不會重合。

“我看看行不行”用的是relative 相對定位,它相對與父級元素定位,也就是第一個DIV,它定位的位置從父級元素裡面的最開始位置算起,所以,如果不設定top的話就會和第二個div重合。而字型的大小一般為15px‘

                 

指定裁剪地區

position:absolute;

clip:rect(top right bottom left);

top:從上到下裁去top的長度。

left:從左至右裁去left的長度。

right:從左至右裁出right的長度。

bottom:從上到下裁出bottom的長度

 

將區塊層級元素轉化為字元級元素

display:inline;

 

將字元級元素轉化為區塊層級元素

display:block;

 

處理溢出 

position:absolute;(必須為absolute)

overflow:visible;  //溢出地區可見

overflow:hidden;   //溢出地區不可見

overflow:scroll;   //溢出地區出現捲軸

 

 盒模型 

有 margin padding border width  height 

簡寫時安上右下左順序來寫

如:border-width:1em 2em 2em 2em

注意:上下左右這幾個屬性:

在設定時如果只出現3個值,則代表上 左右 下  

                 2個值: 上下  左右

                 1個值:全部  =出現4個一樣的值

 

 插入多媒體

<embed src="1.swf" width=300 height=200></embed>

<embed src="1.mp3" width=300 height=200></embed>

<embed src="1.wmv" width=300 height=200></embed> 

轉載


[HTML/CSS]新手入門,指教

<!DOCTYPE html><html><head><title>MyHtml.html</title><meta name="keywords" content="keyword1,keyword2,keyword3"><meta name="description" content="this is my page"><meta name="content-type" content="text/html; charset=UTF-8"><!--<link rel="stylesheet" type="text/css" href="./styles.css">--><style type="text/css"></style></head><body><h1 align="center"><u>請留下設定檔</u></h1><table align="center"><tr><td align="right">姓名:</td><td><input type="text"></td></tr><tr><td align="right">E-mail:</td><td><input type="text"></td></tr><tr><td align="right">電話:</td><td><input type="text"></td></tr><tr><td align="right">性別:</td><td><input type="radio" name="sex">女<input type="radio"name="sex">男</td></tr><tr><td align="right">年齡:</td><td><select name="a5"><option ......餘下全文>>

 
有html基礎div+css要學多久

看學到什麼樣的程度了,如果只是簡單的理論知識再加網頁基本的布局,每天花2--3小時一個星期就可以學會,如果是邊學邊練習的話,這樣花費時間會
更久一些,因為那些理論知識你學的時候聽起來看起來都很簡單,但是實際操作的過程中會遇到一些想不到的問題。這樣算起來至少要多花一倍的時間。但是如果想
學的精細些,網頁布局的精確、顏色搭配、瀏覽器的相容性、還有一些圖片的處理要涉及到PS的這些就要靠自己以後在實踐中慢慢鍛煉了!
如果只是想對DIV+CSS有所瞭解而不是想從事專業的網頁設計的話,那就非常簡單的,幾天就能學會!
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.