ผมลองค้นหา 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;
}

Popularity: 1% [?]

Tagged with:
 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Set your Twitter account name in your settings to use the TwitterBar Section.