https://github.com/neiesc/ListOfMinimalistFrameworks
Cascading Style Sheet
https://github.com/neiesc/ListOfMinimalistFrameworks
Centering lines of text
P { text-align: center }
H2 { text-align: center }
Centering a block of text or an image
P.blocktext {
margin-left: auto;
margin-right: auto;
width: 6em
}
...
<P class="blocktext">This rather...
IMG.displayed {
display: block;
margin-left: auto;
margin-right: auto }
...
<IMG class="displayed" src="..." alt="...">
Centering a block or an image vertically
DIV.container {
min-height: 10em;
display: table-cell;
vertical-align: middle }
...
<DIV class="container">
<P>This small paragraph...
</DIV>
ผมลองค้นหา CSS ที่ใช้ร่วมกับ <pre> tag เพื่อนำมาใช้แสดงโค้ดของโปรแกรม ก็บังเอิญได้พบ CSS ที่ใช้แสดงผลดังนี้
.phpcode, pre {
overflow: auto;
padding-left: 15px;
padding-right: 15px;
font-size: 11px;
line-height: 15px;
margin-top: 10px;
width: 93%;
display: block;
background-color: #eeeeee;
color: #000000;
max-height: 300px;
}
เราสามารถกำหนด white-space: pre; ให้กับแต่ละ element ได้เช่นกัน ดังตัวอย่างต่อไปนี้
.preElement{
white-space: pre;
font-weight: bold;
color: navy;
font-family: arial;
}
และสามารถกำหนดฟอนต์ให้กับ <pre> แท็กดังนี้
pre{
font-weight: bold;
color: navy;
font-family: arial;
}
เนื่องจากผมพยายามที่จะไม่ใช้ attribute ที่ deprecate แล้วของ HTML 4.01 ก็เลยต้องหาวิธีการจัดวางตำแหน่งรูปภาพโดยอาศัยเจ้า CSS มาช่วย ซึ่งผมพบ tutorial เด็ดๆ ที่นี่
Floatutorial: Step by Step CSS float tutorial
http://css.maxdesign.com.au/floatutorial/
CSS image text wrap tutorial
http://www.bigbaer.com/css_tutorials/css.image.text.wrap.tutorial.htm
และของ w3.org ที่นี่
http://www.w3.org/TR/CSS21/visuren.html#float-position
CSS ย่อมาจาก Cascading Style Sheet ถูกนำมาใช้กับ HTML 4.01 เพื่อที่จะช่วยในการแยกส่วนของ HTML tag และ ส่วนของวิธีการแสดงผลบนบราวเซอร์ออกจากกัน ทำให้การเขียนโค้ด HTML ดูสะอาด ไม่วุ่นวาย ซึ่งการนำ CSS มาใช้ก็ทำให้ tag และ attribute หลายอย่างถูกยกเลิกไปในเวอร์ชันที่ strict ของ HTML เช่น tag <center>
ลองดู HTML 4.01 reference ได้ที่นี่
น่าแปลกใจที่ HTML 4.01 ออกมานานแล้ว และก็ได้กลายเป็น XHTML 1.0 ในปัจจุบัน แต่ยังมีสำนักพิมพ์บางแห่งยังตีพิมพ์หนังสือสอน HTML โดยยังอ้างอิง HTML 3.2 อยู่เลย เปิดดูอ่านดูแล้วถึงกับงงครับ
Continue reading Floating an image with CSS/Open a new window in XHTML