dokuwiki:dev:fieldset

差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

Both sides previous revision 前次修改
下次修改
前次修改
dokuwiki:dev:fieldset [2020/10/28 21:30]
ghsrobert ToDo checked: 在 DW 中實測
dokuwiki:dev:fieldset [2020/10/30 00:02] (目前版本)
ghsrobert [CSS]
行 10: 行 10:
  
 ===== plugin ===== ===== plugin =====
 +因為不同的 DW tpl 各有不同的 fieldset、legend CSS,所以本來我想就不做 plugin 了,用下面的純 wrap+CSS 法就好。但後來又想,我也可以弄 plugin,但產生 ''div.fieldset'' 之類的啊。所以就再次來挑戰看看 syntax plugin 吧(雖然之前從來沒成功)。
  
 +  - 試著用 [[doku>plugin:ruby]] 來改
 +    - 開 repo
 +    - 其實語法有頭有尾 ∴也應該參考 wrap 才是 ← 想到就難,先休息好了 <<哈>>
 ==== 參考 ==== ==== 參考 ====
   * [[https://www.dokuwiki.org/devel:syntax_plugin_skeleton|devel:syntax_plugin_skeleton [DokuWiki]]]   * [[https://www.dokuwiki.org/devel:syntax_plugin_skeleton|devel:syntax_plugin_skeleton [DokuWiki]]]
行 22: 行 26:
   * [[https://stackoverflow.com/questions/2213881/is-it-possible-to-achieve-a-fieldset-like-effect-without-using-the-fieldset#answer-2214676|html - Is it possible to achieve a <fieldset>-like effect without using the <fieldset> tag? - Stack Overflow]] 這位提出來的 CSS 效果還不錯   * [[https://stackoverflow.com/questions/2213881/is-it-possible-to-achieve-a-fieldset-like-effect-without-using-the-fieldset#answer-2214676|html - Is it possible to achieve a <fieldset>-like effect without using the <fieldset> tag? - Stack Overflow]] 這位提出來的 CSS 效果還不錯
     * 我在一般網頁實測過也還 okay,就是要多用一個 span 就是了     * 我在一般網頁實測過也還 okay,就是要多用一個 span 就是了
-    * <todo #ghsrobert:2020-10-28>在 DW 中實測</todo><div>+    * <todo #ghsrobert:2020-10-28>在 DW 中實測</todo><code css> 
 +.wrap_fieldset { 
 +  border: 2px groove threedface; 
 +  border-top: none; 
 +  padding: 0.5em; 
 +  margin: 1em 2px; 
 +
 + 
 +.wrap_fieldset>.wrap_legend { 
 +  font: 1em normal; 
 +  margin: -1em -0.5em 0; 
 +
 + 
 +.wrap_fieldset>.wrap_legend>p { 
 +  float: left; 
 +
 + 
 +.wrap_fieldset>.wrap_legend:before { 
 +  border-top: 2px groove threedface; 
 +  content: ' '; 
 +  float: left; 
 +  margin: 0.5em 2px 0 -1px; 
 +  width: 0.75em; 
 +
 + 
 +.wrap_fieldset>.wrap_legend:after { 
 +  border-top: 2px groove threedface; 
 +  content: ' '; 
 +  display: block; 
 +  height: 1.5em; 
 +  left: 2px; 
 +  margin: 0 1px 0 0; 
 +  overflow: hidden; 
 +  position: relative; 
 +  top: 0.5em; 
 +
 +</code>可以看到我把原作者的 span 改成了 p,因為 wrap plugin 本身就會產生 p,這樣少一道輸入。結果:<div>
 <div fieldset><div legend>標題</div> <div fieldset><div legend>標題</div>
 內容 內容
 </div> </div>
 +</div><code>
 +<div fieldset><div legend>標題</div>
 +內容
 </div> </div>
 +</code>
 +      * 在主站勉強可以(內容的位置會往右縮排,不知何故)
 +      * 在 mikio tpl 中,legend 的位置就跑掉了
 +      * ↑<code css>.wrap_fieldset>.wrap_legend>p {
 +  margin-top: 0;
 +  margin-bottom: 0;
 +}</code>↑加上這兩行的話可以解決 legend p 的高度,以及因為 float 而影響內容位置的問題 :) 這樣可用性就提高了~
 +
 +==== 參考 ====
 +  * [[https://www.google.com/search?q=css+style+like+fieldset+legend|css style like fieldset legend - Google 搜尋]]
  • 上一次變更: 2020/10/28 21:30
  • ghsrobert