Basic Werk | Blog | Contact


MEMOMEM

HTML_white-space_nowrap



随分昔の記憶で、指定した文字列を自動的に改行させたくない場合は <NOBR></NOBR> を使っていたように思うのだが、これは Netscape の独自仕様だそうで、HTML5 では廃止されてるそうです。アーメン。


なので、現在は CSS から white-space: 属性を使いましょう。



/* ボックスの大きさに応じて改行する */ span.normal { white-space: normal; }
/* <PRE> タグといっしょ */ span.pre { white-space: pre; }
/* このクラスの部分文字列は改行しない */ /* ボックスに幅に達する前に、*/ /* 部分文字列ごと次の行に送られる */ span.nowrap { white-space: nowrap; }


参考はいつもお世話になっている、

HTMLクイックリファレンス

http://www.htmq.com/style/white-space.shtml


#HTML #CSS #HTML5



SN 2013/06/27 10:32:01

Archives > HTML_white-space_nowrap.html





textarea_wrap



textarea で、入力時の表示上は自動改行するが、データ送信時には改行したくない場合は、wrap 属性に soft を指定する。



<textarea rows=5 cols=40 name="input" wrap="soft"></textarea>


以下、個人的なテスト。


Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample Text


#HTML #CSS



SN 2013/06/26 23:19:21

Archives > textarea_wrap.html





20130623100533_textarea_width



textarea の cols 属性に左右されずに横幅を設定するには単に css で width を設定してあげればよかった。

で、この方法だと、ブラウザの違い(PC と iPhone とか)で textarea の幅を変えれるところが良い。



textarea { width:650px; }
@media screen and (max-device-width: 480px) { textarea { width:270px; } }



#HTML #CSS #SPWeb



SN 2013/06/26 23:17:51

Archives > 20130623100533_textarea_width.html





HTML_Font_Sample



HTML でほぼほぼ使える Font のサンプル集


CSS FONT STACK

http://cssfontstack.com/


#HTML #CSS



SN 2013/06/26 22:02:49

Archives > HTML_Font_Sample.html