MozTW 討論區 https://forum.moztw.org/ |
|
CSS https://forum.moztw.org/viewtopic.php?f=13&t=5839 |
第 1 頁 (共 3 頁) |
發表人: | kaiuisme [ 2005-01-12, 00:38 ] |
文章主題 : | CSS |
<body style="text-align: center"> <table border="1"> <tr style="background-color: yellow; color: red"> <th>姓名</th> <th>性別</th> <th>血型</th> 這是書中的部分原始碼,可是在IE看,表格會至中對齊,在FF看,表格確向左對齊,這是什麼樣的情形呢? |
發表人: | 訪客 [ 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 |
發表人: | kaiuisme [ 2005-01-12, 12:52 ] |
文章主題 : | |
可以問一下 margin-left: auto; margin-right: auto; 這是在幹麼的嗎?書中完全是用IE的,氣死人... ![]() |
發表人: | BobChao [ 2005-01-12, 13:43 ] |
文章主題 : | |
kaiuisme 寫: 可以問一下 margin-left: auto; margin-right: auto;
這是在幹麼的嗎?書中完全是用IE的,氣死人... ![]() 白話文:表格!你的寬度就是 60%,至於左右側與邊緣之間的距離,就自己調整吧! |
發表人: | robinw [ 2005-01-12, 14:25 ] |
文章主題 : | |
BobChao 寫: 白話文:表格!你的寬度就是 60%,至於左右側與邊緣之間的距離,就自己調整吧!
這樣的解釋很讚 8) |
發表人: | Carousel [ 2005-01-12, 16:49 ] |
文章主題 : | |
看過幾個有關表格的問題 都是置中 但是 align="center" 是有效的語法啊 試試 http://test.carousel.com.tw/tb.html 看看原始檔 <table width="680" border="0" align="center" cellpadding="1" cellspacing="1"> 有人看起來表格不是置中的, 請告訴我, 謝謝 |
發表人: | xacid [ 2005-01-12, 17:07 ] |
文章主題 : | |
Carousel 寫: 但是 align="center" 是有效的語法啊
但是原發文者沒用 align="center" 啊!現在也不建議這樣用了。 原來的例子用 text-align 這個屬性,這樣只有 "text" 會置中,表格不聽話算正常吧? |
發表人: | kaiuisme [ 2005-01-12, 21:21 ] | ||
文章主題 : | |||
嗯,謝謝以上的回答,但是我又看書看到了一個問題 這個問題用IE和用FF有很大的不同 請問是那個環節出錯了啊 中間的background-position: center; 也是不一樣啊,真是不知該如何解決啊!
|
發表人: | kaiuisme [ 2005-01-12, 23:16 ] |
文章主題 : | |
<?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用預覽則有作用耶! |
發表人: | 訪客 [ 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/ |
發表人: | 訪客 [ 2005-01-13, 02:03 ] |
文章主題 : | |
對了,忘了補充這個網址了, 裡面的 CSS 區有教你如何處理 IE6 對 CSS 支援不佳的問題, 至於 IE Only 的 CSS ………請當做沒看過這東西。 http://www.andcycle.idv.tw/mediawiki/in ... :_Makeuper |
發表人: | 訪客 [ 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實在是不會使用! |
發表人: | BobChao [ 2005-01-13, 12:58 ] |
文章主題 : | |
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, 應該不用「+」...) |
發表人: | kaiuisme [ 2005-01-13, 13:53 ] |
文章主題 : | |
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相容模式啊? |
發表人: | 訪客 [ 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 真是讓人猜不透阿 |
第 1 頁 (共 3 頁) | 所有顯示的時間為 UTC + 8 小時 |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |