2017-04-19 68 views
1

我想知道如何將放大器的內容放在頁面 中,比如ampbyexample DEMO: HOUSING如何設置AMP中心內容佈局?

我嘗試編碼如下,但無法工作!

<style amp-custom> 
body{margin:0 auto; max-width: 985px; } 
</style> 

的最大寬度變化985px,但在左側的內容... 非常感謝

回答

0

請創建身體內的包裝DIV比應用CSS規則

請遵照這

<!doctype html> 
<html amp lang="en"> 
    <head> 
    <meta charset="utf-8"> 
    <script async src="https://cdn.ampproject.org/v0.js"></script> 
    <title>Hello, AMPs</title> 
    <link rel="canonical" href="http://example.ampproject.org/article-metadata.html" /> 
    <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> 
    <script type="application/ld+json"> 
     { 
     "@context": "http://schema.org", 
     "@type": "NewsArticle", 
     "headline": "Open-source framework for publishing content", 
     "datePublished": "2015-10-07T12:02:41Z", 
     "image": [ 
      "logo.jpg" 
     ] 
     } 
    </script> 
    <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> 
    <style amp-custom> .wrapper{margin:0 auto; max-width: 985px; }</style> 

    </head> 
    <body> 
    <div class="wrapper"> 
     <h1>Welcome to the mobile web</h1> 
    </div> 
    </body> 
</html> 
+0

不行....請幫助 –

+0

你還在尋找解決方案? –

+0

是的,請! 非常感謝! –

0
<!doctype html> 
<html amp lang="zh"> 
    <head> 
    <meta charset="utf-8"> 
    <title>Sample document</title> 
    <link rel="canonical" href="./regular-html-version.html"> 
    <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> 

    <script async src="https://cdn.ampproject.org/v0.js"></script> 
    <script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js"></script> 
    <script async custom-element="amp-accordion" src="https://cdn.ampproject.org/v0/amp-accordion-0.1.js"></script> 
    <script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script> 
    <script async custom-element="amp-install-serviceworker" src="https://cdn.ampproject.org/v0/amp-install-serviceworker-0.1.js"></script> 
    <script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script> 
    <script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script> 
    <script async custom-element="amp-iframe" src="https://cdn.ampproject.org/v0/amp-iframe-0.1.js"></script> 
    <script async custom-element="amp-fit-text" src="https://cdn.ampproject.org/v0/amp-fit-text-0.1.js"></script> 

    <style amp-custom> 
body {margin:0 auto; max-width: 985px; width:100%; } 
p {text-align: center;} 


amp-accordion section[expanded] .show-more {display: none;} 
amp-accordion section:not([expanded]) .show-less {display: none;} 
.i-amphtml-accordion-header{cursor:pointer;background-color:#336699;padding-right:20px;border:1px solid #dfdfdf} 
.nested-accordion h1 {font-size: 140px;background-color: #000;} 
amp-accordion#hidden-header section[expanded] h1 {border: none;} 

    </style>