2015-10-19 52 views
1

我有一個表代碼。該表有6列。我在wordpress上創建了一個新頁面,然後在文本編輯器中輸入我的代碼,然後發佈。CSS和表列在wordpress中損壞

但顯示的CSS破碎和列分解到下面。但我希望所有列都是同一行。

見WordPress的破CSS觀點: http://i.stack.imgur.com/tATOQ.png

見下面我的代碼:

<html> 
<head> 
<style> 
@import url(http://fonts.googleapis.com/css?family=Ubuntu); 
* { 
    margin: 0; 
    padding: 0; 
} 
body { 
    font-family: Ubuntu, arial, verdana; 
} 
.pricing_table { 
float: center; 
    line-height: 150%; 
    font-size: 12px; 
    margin: 0 auto; 
    width: 500%; 
    max-width: 800px; 
    padding-top: 1px; 
    margin-top: 20px; 
} 
.price_block { 
    text-align: center; 
    width: 100%; 
    color: #fff; 
    float: left; 
    list-style-type: none; 
    transition: all 0.25s; 
    position: relative; 
    box-sizing: border-box; 
    margin-bottom: 10px; 
    border-bottom: 1px solid transparent; 
} 

.pricing_table h3 { 
    text-transform: uppercase; 
color: #fff; 
    padding: 5px 0; 
    background: #A6DA18; 
    margin: -10px 0 1px 0; 
} 

.price { 
    display: table; 
    background: #444; 
float: center; 
    width: 100%; 
    height: 70px; 
} 
.price_figure { 
    font-size: 24px; 
    text-transform: uppercase; 
    vertical-align: middle; 
    display: table-cell; 
} 
.price_number { 
    font-weight: bold; 
    display: block; 
} 
.price_tenure { 
    font-size: 11px; 
} 

.features { 
    background: #DEF0F4; 
    color: #000; 
} 
.features li { 
    padding: 8px 15px; 
    border-bottom: 1px solid #ccc; 
    font-size: 11px; 
    list-style-type: none; 
} 

.footer { 
    padding: 15px; 
    background: #DEF0F4; 
} 
.action_button { 
    text-decoration: none; 
    color: #fff; 
    font-weight: bold; 
    border-radius: 5px; 
    background: linear-gradient(#666, #333); 
    padding: 5px 20px; 
    font-size: 11px; 
    text-transform: uppercase; 
} 

.price_block:hover { 
    box-shadow: 0 0 0px 5px rgba(0, 0, 0, 0.5); 
    transform: scale(1.04) translateY(-5px); 
    z-index: 1; 
    border-bottom: 0 none; 
} 
.price_block:hover .price { 
    background:linear-gradient(#DB7224, #F9B84A); 
    box-shadow: inset 0 0 45px 1px #DB7224; 
} 
.price_block:hover h3 { 
    background: #222; 
} 
.price_block:hover .action_button { 
    background: linear-gradient(#F9B84A, #DB7224); 
} 

@media only screen and (min-width : 768px) and (max-width : 768px) { 
    .price_block {width: 50%;} 
    .price_block:nth-child(odd) {border-right: 1px solid transparent;} 
    .price_block:nth-child(3) {clear: both;} 
    .price_block:nth-child(odd):hover {border: 0 none;} 
} 
@media only screen and (min-width : 768px){ 
    .price_block {width: 25%;} 
    .price_block {border-right: 1px solid transparent; border-bottom: 0 none;} 
    .price_block:last-child {border-right: 0 none;} 
    .price_block:hover {border: 0 none;} 
} 


</style> 
</head> 

<body> 
<ul class="pricing_table"> 
<li class="price_block"> 
     <h3> 
Standard</h3> 
<div class="price"> 
      <div class="price_figure"> 
       <span class="price_number">$19.99</span> 
       <span class="price_tenure">Good</span> 
      </div> 
</div> 
<ul class="features"> 
<li>6,245 Links</li> 
<li>Panda & Penguine Friendly</li> 
<li>Manual Instructions</li> 
<li>Email Support</li> 
</ul> 
<div class="footer"> 
      <a class="action_button" href="http://www.blogger.com/blogger.g?blogID=7860351751400882510#">Buy Now</a> 

     </div> 
</li> 
<li class="price_block"> 
     <h3> 
Professional</h3> 
<div class="price"> 
      <div class="price_figure"> 
       <span class="price_number">$39.99</span> 
       <span class="price_tenure">Best Value</span> 
      </div> 
</div> 
<ul class="features"> 
<li>6,245 Links</li> 
<li>Panda & Penguine Friendly</li> 
<li>Manual Instructions</li> 
<li>Email & Phone Support</li> 
</ul> 
<div class="footer"> 
      <a class="action_button" href="http://www.blogger.com/blogger.g?blogID=7860351751400882510#">Buy Now</a> 

     </div> 
</li> 
<li class="price_block"> 
     <h3> 
Professional</h3> 
<div class="price"> 
      <div class="price_figure"> 
       <span class="price_number">$39.99</span> 
       <span class="price_tenure">Best Value</span> 
      </div> 
</div> 
<ul class="features"> 
<li>6,245 Links</li> 
<li>Panda & Penguine Friendly</li> 
<li>Manual Instructions</li> 
<li>Email & Phone Support</li> 
</ul> 
<div class="footer"> 
      <a class="action_button" href="http://www.blogger.com/blogger.g?blogID=7860351751400882510#">Buy Now</a> 

     </div> 
</li> 
<li class="price_block"> 
     <h3> 
Professional</h3> 
<div class="price"> 
      <div class="price_figure"> 
       <span class="price_number">$39.99</span> 
       <span class="price_tenure">Best Value</span> 
      </div> 
</div> 
<ul class="features"> 
<li>6,245 Links</li> 
<li>Panda & Penguine Friendly</li> 
<li>Manual Instructions</li> 
<li>Email & Phone Support</li> 
</ul> 
<div class="footer"> 
      <a class="action_button" href="http://www.blogger.com/blogger.g?blogID=7860351751400882510#">Buy Now</a> 

     </div> 
</li> 
<li class="price_block"> 
     <h3> 
Professional</h3> 
<div class="price"> 
      <div class="price_figure"> 
       <span class="price_number">$39.99</span> 
       <span class="price_tenure">Best Value</span> 
      </div> 
</div> 
<ul class="features"> 
<li>6,245 Links</li> 
<li>Panda & Penguine Friendly</li> 
<li>Manual Instructions</li> 
<li>Email & Phone Support</li> 
</ul> 
<div class="footer"> 
      <a class="action_button" href="http://www.blogger.com/blogger.g?blogID=7860351751400882510#">Buy Now</a> 

     </div> 
</li> 
<li class="price_block"> 
     <h3> 
Business</h3> 
<div class="price"> 
      <div class="price_figure"> 
       <span class="price_number">$49.99</span> 
       <span class="price_tenure">Recommended for Business</span> 
      </div> 
</div> 
<ul class="features"> 
<li>6,245 Links</li> 
<li>Panda & Penguine Friendly</li> 
<li>Manual Instructions</li> 
<li>Email & Phone Support</li> 
</ul> 
<div class="footer"> 
      <a class="action_button" href="http://www.blogger.com/blogger.g?blogID=7860351751400882510#">Buy Now</a> 

     </div> 
</li> 
</ul> 

</body> 
</html> 

回答

0

在你的CSS的min-width : 768px媒體查詢後有這樣的代碼:

.price_block {width: 25%;} 

這使得每塊25%寬,因此它們就像那樣排列(第一排4等)。你需要改變,如此6在同一行符合(〜16%範圍內)

.price_block {width: 16.66%;} 

你可以看到它在這裏工作(如果你拓寬輸出窗口顯示列):

http://jsfiddle.net/eurz4a2k/

+0

謝謝,我會試試看。但是,你能告訴我爲什麼CSS在wordpress中顯示破損的樣式嗎? – rwudeess

+0

@rwudeess你將不得不更具體,什麼壞了等 – BobbyTables

+0

不工作。你可以在這裏添加編輯完整的代碼嗎? – rwudeess

0

您必須將html和css內容放在兩個不同的文件中。你所有的CSS類都被wordpress類覆蓋。單獨保存並加載它。

+0

請舉例嗎? – rwudeess