前端開發中一些常用技巧總結

2022-03-19 04:49:27 字數 3124 閱讀 6964

1.文章標題列表中日期居右顯示的方法:

[email protected]這是文章標題

然後定義span右浮動: p span 其實這種方法可以延伸到很多情況下,很實用的一種寫法;

2.web標準中,同一頁面中只能有乙個h1標籤.很多人知道這個概念,但做到的卻很少;

3.空白外邊距互相疊加的問題:一般通過新增透明邊框或者1px的內邊距避免.;

推薦兩種解決方式:

其一,為外圍元素定義透明邊框.具體到本例,即在樣式div中加入border:1px solid transparent;

其二,為外圍元素定義內邊距填充..具體到本例,即在樣式div中加入padding:1px

另外,還可以通過外圍元素絕對定位,或者定義子元素浮動等方式實現.zoom:1;overflow:hidden

4.ie6下max/min-width/height實現,_width: expression(this.width >600 ? 「600px」 : true);,height同理. 5.html/class/id,最好統一以小寫書寫,這樣更嚴謹(符合xhtml標準);

6.不推薦用下面**相容ie8:

如果是非短期性頁面,盡量避免使用,頁面應盡可能保證向後相容;

7.空div在ie(ff中沒有)是有預設高度的,可以用定義:div 的方式去掉預設高度;

8.在使用table標籤時應該盡可能的利用它本身的屬性,最大限度的分離結構與樣式.;

html**:

<

tableid=

"itab

">

<

caption

>

最大限度的分離table的樣式與結構,uh oh!

caption

>

<

colgroup

>

<

colclass="

linenum

">

<

colclass="

id-1

">

<

colclass="

id-2

">

<

colclass="

id-3

">

colgroup

>

<

thead

>

<

tr><

th>

linenum

th><

th>

id-1

th><

th>

id-2

th><

th>

id-3

th>

tr>

thead

>

<

tbody

>

<

tr><

td>1td

><

td>atd

><

td>

cytd

><

td>itd

>

tr>

<

tr><

td>2td

><

td>

brtd

><

td>std

><

td>

kmqtd

>

tr>

<

tr><

td>3td

><

td>

htctd

><

td>

llitd

><

td>ptd

>

tr>

<

tr><

td>4td

><

td>

acctd

><

td>gtd

><

td>

qotd

>

tr>

<

tr><

td>5td

><

td>ztd

><

td>

ahdtd

><

td>mtd

>

tr>

tbody

>

<

tfoot

>

<

tr><

th>

line.no

th><

th>

id-1

th><

th>

id-2

th><

th>

id-3

th>

tr>

tfoot

>

table

>

css**:

table#itab

#itab

caption

#itab

thead

#itabtd,

table#itab

th#itab

td#itab

tfoot

#itab

.linenum

#itab

.id-1

#itab

.id-2

#itab

.id-3

9.充分利用表單中label標籤提公升使用者體驗; 這一點對於頁面中那些小的選項框,以及對殘障人士閱讀**都有好處. 細節是使用者體驗的第一步;

10.fieldset, legend標籤, 鮮為人知,卻很實用的一組標籤;它可以很明了的把一組元素框起來,主要用於表單;

11.optgroup標籤,鮮為人知,它對提公升選擇表單使用者體驗很有幫助.作用? 就是可以在有很多選項時,對這些選項分組: one select

two select

three select

four select

效果演示: one selecttwo selectthree selectfour select

12.表單都要加name值,name值是乙個標示,不同於id,據我所發現,若是未定義name值,非ie瀏覽器下是無法通過document.formid獲取到表單元素的.請看如下**及注釋:

Qt Creator中一些常用小技巧(總結)

參考部落格 以下 摘抄以上大神部落格 1 注釋 常用雙斜槓 是單行注釋,可以多行注釋,其實在qt creator裡面還有一種注釋方式也非常好用,三個斜槓 回車後會自動建立新的一行注釋來,比較方便 2 函式說明 需要寫注釋說明,那這時候可以快速的生成乙個函式說明的注釋格式,在函式名的上一行,輸入 然後...

PB中一些技巧

取資料視窗中可列新的表名。string ls table ls table dw 1.describe datawindow.updatetable.table 22.取資料視窗物件中列的名稱及型別 string ls cols,ls types intli count,i li count int...

PB中一些技巧

取資料視窗中可列新的表名。string ls table ls table dw 1.describe datawindow.updatetable.table 22.取資料視窗物件中列的名稱及型別 string ls cols,ls types intli count,i li count int...