html基础点知识

<title>
display 设置inline 显示为内联后,div的宽度由其内容来决定,如何想要一个固定的宽度,显示可以用"行内块" 为 inline-block,另一个显示的值
是"弹性布局(flexble box)","flex"要为父级元素设置,flex在这里有自动变为行内块的排列,接下来,设置"弹性方向",设置div margin: auto
外边距自动,自动按照全部宽度进行弹性布局
<link rel="stylesheet" href="styles.css">
选择器筛选规则,例如 只会为section内既有feature-box又有sales的div类添加样式
</title>

<style>
    body {
        background: rgb(58,58,58);
        color: white;
        font-family: Helvetica Neue,Helvetica,Arial,sans-serif;
        margin: 0;
        padding: 0;
    }

    header {
        background-color: black;
        background-image: url("images/hero.jpg");
        background-size: 100%;
        background-position: center;
        padding: 20px;
        height: 400px;
        padding: 20px;
        text-align: center;
    }

    header a {
        color: white;
        text-decoration: none;
        text-transform: uppercase;
        margin-top: 40px;
    }

    header .logo a {
        background-color: red;
        background-size: 300px;
        background-repeat: no-repeat;
        display: inline-block;
        height: 80px;
        position: relative;
        text-indent: -99999999px;
        top: -30px;
        width: 300px;
    }

    .features {
        background: white;
        color: gray;
        padding: 20px;
        display: flex;
        flex-direction: row;
    }
   .features figure {
       background-color: blue;
        margin: auto;
        width: 200px;
       text-align: center;
       text-transform: uppercase;
    }

   .features figure img {
       border: 1px solid white;
       border-radius: 50%;
       box-shadow: gray 0 0 10px;
       width: 200px
   }


    ul {
        margin: 0;
        padding: 0;
        list-style-type: none;
    }

    li {
        display: inline-block;
        background: gray;
        border-radius: 3px;
        padding: 2px;
        margin-left: 20px;
    }

    li:first-child {
        margin-left: 0;
    }

    a {
        text-decoration: none;
    }

    a:hover {
        text-decoration: underline;
    }

    footer {
        background: black;
        padding: 10px 20px;
    }
</style>

 <header>
    <nav>
        <ul>
            <li><a href="index04.html">Home</a></li>
            <li><a href="locations.html">locations</a></li>
            <li class="logo"><a href="index04.html">Artisan Bakery logo</a></li>
            <li><a href="contact.html">contact</a></li>
        </ul>
    </nav>
    <h1></h1>
</header>
<section class="features">
    <figure>
        <img src="images/breads.jpg" alt="amazing fresh baked bread">
        <figcaption>Fresh Baked Bread</figcaption>
    </figure>
    <figure>
        <img src="images/coffee.jpg" alt="amazing fresh baked coffee">
        <figcaption>Fresh Baked coffee</figcaption>
    </figure>
    <figure>
        <img src="images/goods.jpg" alt="amazing fresh baked goods">
        <figcaption>Fresh Baked goods</figcaption>
    </figure>
</section>
<section class="feature-box closeouts">
    <div>section d</div>
    <div>section e</div>
</section>
<footer>footer</footer>
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容