zoukankan      html  css  js  c++  java
  • 使用css将图像居中

    默认情况下,图像属于内联元素。这意味着它们与周围的文本一起流动。为使图像居中,我们应该将其转换成块级元素,通过将display属性的值设置为block就可以完成转换。

    <html>
        <head>
            <title>TODO supply a title</title>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <style type="text/css">
                body {
    		font-family: Georgia, "Times New Roman", serif;
    		color: #665544;}
                img.align-center {
                    display: block;
                    margin: 0px auto;}
                img.medium {
                     250px;
                    height: 250px;}
            </style>
        </head>
        <body>
            <div>TODO write content</div>
            <p><img src="magnolia-medium.jpg" alt="Magnolia" class="align-center medium" /><b><i>Magnolia</i></b> is a large genus that contains over 200 flowering plant species. It is named after French botanist Pierre Magnol and, having evolved before bees appeared, the flowers were developed to encourage pollination by beetle.</p>
        </body>
    </html>
    
  • 相关阅读:
    899. Orderly Queue
    856. Score of Parentheses
    833. Find And Replace in String
    816. Ambiguous Coordinates
    770. Basic Calculator IV
    冒泡排序(Bubble Sort)
    C
    B
    A
    HDOJ-1391
  • 原文地址:https://www.cnblogs.com/q2546/p/9460221.html
Copyright © 2011-2022 走看看