MozTW 討論區

各項 Mozilla 相關軟體與技術討論
現在的時間是 2025-08-24, 01:15

所有顯示的時間為 UTC + 8 小時





發表新文章 回覆主題  [ 33 篇文章 ]  前往頁數 123  下一頁
發表人 內容
 文章主題 : CSS
文章發表於 : 2005-01-12, 00:38 
離線

註冊時間: 2004-02-16, 09:27
文章: 24
<body style="text-align: center">
<table border="1">
<tr style="background-color: yellow; color: red">

<th>姓名</th>
<th>性別</th>
<th>血型</th>

這是書中的部分原始碼,可是在IE看,表格會至中對齊,在FF看,表格確向左對齊,這是什麼樣的情形呢?


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.7.5) Gecko/20041119 Firefox/1.0
 個人資料  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-12, 03:36 
text-align 是對 block 物件底下的 inline 物件作用的,
請利用 W3C 的文件來確認各標籤的屬性。

http://www.w3.org/TR/1999/REC-html401-19991224/

(不過因為我不知道哪兒有列出各標籤的屬性列表所以只能丟這個了)

想要讓表格置中的話,這樣子寫就行了。

<table style="width:60%;margin-left:auto;margin-right:auto;">

也就是說是利用 width 和 margin 來調整位置啦。

簡單說明 text-align 是拿來對文字作用的這樣,
圖片應該也行不過我不常用到不清楚,
這些你多花點時間嘗試就能摸出個道理來了,
其它的就請利用 W3C 的文件吧。

http://chinese-school.netfirms.com/css- ... -index.htm


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.7.5) Gecko/20041107 Firefox/1.0
  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-12, 12:52 
離線

註冊時間: 2004-02-16, 09:27
文章: 24
可以問一下 margin-left: auto; margin-right: auto;

這是在幹麼的嗎?書中完全是用IE的,氣死人... :evil:


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.7.5) Gecko/20041119 Firefox/1.0
 個人資料  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-12, 13:43 
離線
[網站管理員]
頭像

註冊時間: 2002-01-07, 19:28
文章: 3080
來自: 台灣
kaiuisme 寫:
可以問一下 margin-left: auto; margin-right: auto;

這是在幹麼的嗎?書中完全是用IE的,氣死人... :evil:


白話文:表格!你的寬度就是 60%,至於左右側與邊緣之間的距離,就自己調整吧!

_________________
雜工 :: 柏強 / Bob Chao
發問討論請保持禮節,在志工社群裡沒有人有「義務」要為您做些什麼。

* MozTW 志工無限招募中,開放網路世界需要您的一臂之力


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.7.5) Gecko/20041119 Firefox/1.0
 個人資料  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-12, 14:25 
離線

註冊時間: 2004-11-23, 17:21
文章: 76
BobChao 寫:
白話文:表格!你的寬度就是 60%,至於左右側與邊緣之間的距離,就自己調整吧!

這樣的解釋很讚 8)


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.7.5) Gecko/20041111 Firefox/1.0 (JTw)
 個人資料  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-12, 16:49 
離線
頭像

註冊時間: 2004-11-30, 10:46
文章: 101
看過幾個有關表格的問題
都是置中
但是 align="center" 是有效的語法啊

試試

http://test.carousel.com.tw/tb.html

看看原始檔

<table width="680" border="0" align="center" cellpadding="1" cellspacing="1">

有人看起來表格不是置中的, 請告訴我, 謝謝

_________________
圖檔圖檔圖檔
我們原本就會的,因遺忘而要重頭學習
我的網誌 http://audi.tw


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.0; zh-TW; rv:1.7.5) Gecko/20041119 Firefox/1.0
 個人資料  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-12, 17:07 
離線

註冊時間: 2004-07-03, 22:04
文章: 444
Carousel 寫:
但是 align="center" 是有效的語法啊


但是原發文者沒用 align="center" 啊!現在也不建議這樣用了。
原來的例子用 text-align 這個屬性,這樣只有 "text" 會置中,表格不聽話算正常吧?


回頂端
Mozilla/5.0 (X11; U; Linux i686; zh-TW; rv:1.7) Gecko/20040616
 個人資料  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-12, 21:21 
離線

註冊時間: 2004-02-16, 09:27
文章: 24
嗯,謝謝以上的回答,但是我又看書看到了一個問題
這個問題用IE和用FF有很大的不同
請問是那個環節出錯了啊
中間的background-position: center;
也是不一樣啊,真是不知該如何解決啊!


附加檔案:
檔案註釋: 請幫我看看這個檔案
6-8.rar [6.7 KiB]
被下載 359 次
回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.7.5) Gecko/20041119 Firefox/1.0
 個人資料  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-12, 23:16 
離線

註冊時間: 2004-02-16, 09:27
文章: 24
<?xml version="1.0" encoding="BIG5"?>
<!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>
範例6-16
</title>
</head>
<body>
<h1 style="text-align: center">
使用相對定位來設定文字的位置
</h1>

<br />
<br />
<div style="text-align: center">
注意
<span style="position:relative; top: -6">
@
</span>
的符號向上移 6px.
<span style="position:relative; top: +6">
H
<span style="vertical-align: sub">

2
</span>
O
</span>
向下移 6px.
</div>
</body>
</html>

另外感覺這一段程式碼在FF 1.0中沒作用,可是在NVU 0.5用預覽則有作用耶!


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.7.5) Gecko/20041119 Firefox/1.0
 個人資料  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-13, 01:33 
printview.php?start=0&t=1974

另外請利用 W3C 的網站及文件,
中文的 CSS 教學上面也有給網址了可以看一看。
http://w3c.org/

其實你只要學會 HTML 跟 CSS 的使用概念就行了,
其它的靠 W3C 的文件會比較適合,
或者你可以乾脆寄信跟出版社抱怨。

另外推薦你的 Firefox 安裝 Web Developer 這擴充套件,
至於安裝擴充套件的方法嘛…有問題的時候再問吧。

WebDeveloper (裝 mozilla update 上的 0.8 版較穩定)
http://update.mozilla.org/extensions/moreinfo.php?id=60
http://www.chrispederick.com/work/firef ... /download/

其它的…參考看看 hemiola 兄的網頁??
http://hemiolapei.free.fr/


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.7.5) Gecko/20041107 Firefox/1.0
  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-13, 02:03 
對了,忘了補充這個網址了,
裡面的 CSS 區有教你如何處理 IE6 對 CSS 支援不佳的問題,
至於 IE Only 的 CSS ………請當做沒看過這東西。

http://www.andcycle.idv.tw/mediawiki/in ... :_Makeuper


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.7.5) Gecko/20041107 Firefox/1.0
  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-13, 09:24 
9.3.1 Choosing a positioning scheme: 'position' property

The 'position' and 'float' properties determine which of the CSS2 positioning algorithms is used to calculate the position of a box.

'position'
Value: static | relative | absolute | fixed | inherit
Initial: static
Applies to: all elements, but not to generated content
Inherited: no
Percentages: N/A
Media: visual

The values of this property have the following meanings:

static
The box is a normal box, laid out according to the normal flow. The 'left' and 'top' properties do not apply.
relative
The box's position is calculated according to the normal flow (this is called the position in normal flow). Then the box is offset relative to its normal position. When a box B is relatively positioned, the position of the following box is calculated as though B were not offset.
absolute
The box's position (and possibly size) is specified with the 'left', 'right', 'top', and 'bottom' properties. These properties specify offsets with respect to the box's containing block. Absolutely positioned boxes are taken out of the normal flow. This means they have no impact on the layout of later siblings. Also, though absolutely positioned boxes have margins, they do not collapse with any other margins.
fixed
The box's position is calculated according to the 'absolute' model, but in addition, the box is fixed with respect to some reference. In the case of continuous media, the box is fixed with respect to the viewport (and doesn't move when scrolled). In the case of paged media, the box is fixed with respect to the page, even if that page is seen through a viewport (in the case of a print-preview, for example). Authors may wish to specify 'fixed' in a media-dependent way. For instance, an author may want a box to remain at the top of the viewport on the screen, but not at the top of each printed page. The two specifications may be separated by using an @media rule, as in:

Example(s):


@media screen {
H1#first { position: fixed }
}
@media print {
H1#first { position: static }
}

這是從W3C所弄下來的網頁,W3C也定義的蠻清楚的,可是就是不知我上例PO的程式碼,為什麼在FIREFOX中不能跑!
另外,那個Developer實在是不會使用!


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.7.5) Gecko/20041119 Firefox/1.0
  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-13, 12:58 
離線
[網站管理員]
頭像

註冊時間: 2002-01-07, 19:28
文章: 3080
來自: 台灣
kaiuisme 寫:
<?xml version="1.0" encoding="BIG5"?>
<span style="position:relative; top: -6">
<span style="position:relative; top: +6">

這三行,第一行建議不要加(會讓 IE 進入 Quirk 相容模式)
第二行跟第三行的 top 加上單位試試?
(-6px and 6px, 應該不用「+」...)

_________________
雜工 :: 柏強 / Bob Chao
發問討論請保持禮節,在志工社群裡沒有人有「義務」要為您做些什麼。

* MozTW 志工無限招募中,開放網路世界需要您的一臂之力


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.7.5) Gecko/20041119 Firefox/1.0
 個人資料  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-13, 13:53 
離線

註冊時間: 2004-02-16, 09:27
文章: 24
BobChao 寫:
kaiuisme 寫:
<?xml version="1.0" encoding="BIG5"?>
<span style="position:relative; top: -6">
<span style="position:relative; top: +6">

這三行,第一行建議不要加(會讓 IE 進入 Quirk 相容模式)
第二行跟第三行的 top 加上單位試試?
(-6px and 6px, 應該不用「+」...)


謝啦,真的解決了耶!
不過什麼是Quirk相容模式啊?


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.7.5) Gecko/20041119 Firefox/1.0
 個人資料  
引用回覆  
 文章主題 :
文章發表於 : 2005-01-13, 17:20 
kaiuisme 寫:
BobChao 寫:
kaiuisme 寫:
<?xml version="1.0" encoding="BIG5"?>
<span style="position:relative; top: -6">
<span style="position:relative; top: +6">

這三行,第一行建議不要加(會讓 IE 進入 Quirk 相容模式)
第二行跟第三行的 top 加上單位試試?
(-6px and 6px, 應該不用「+」...)


謝啦,真的解決了耶!
不過什麼是Quirk相容模式啊?

若是不符合 W3C 標準,就會進入 Quirk 相容模式,
簡單的說就是"就算它不符合標準,也盡量去解讀它"

那那那~~明明 <?xml version="1.0" encoding="BIG5"?>是標準寫法,為什麼 IE 會進入相容模式 ?
這個問題你要問 IE 了 orz 真是讓人猜不透阿


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.7.5) Gecko/20041119 Firefox/1.0
  
引用回覆  
顯示文章 :  排序  
發表新文章 回覆主題  [ 33 篇文章 ]  前往頁數 123  下一頁

所有顯示的時間為 UTC + 8 小時


誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 6 位訪客


不能 在這個版面發表主題
不能 在這個版面回覆主題
不能 在這個版面編輯您的文章
不能 在這個版面刪除您的文章
不能 在這個版面上傳附加檔案

搜尋:
前往 :  
Powered by phpBB® Forum Software © phpBB Group
正體中文語系由 竹貓星球 維護製作
© moztw.org, Mozilla Foundation
MozTW,Mozilla 台灣社群