使用CSS在HTML中自定义形状的正文

custom shaped body in HTML using CSS

本文关键字:正文 自定义 CSS HTML 使用      更新时间:2024-01-02

我想使用HTML、CSS和javascript编写以下布局。

http://tinypic.com/r/zvzd6g/5

我想不出怎样才能在相同形状的版式中制作幻灯片。在photoshop中拍摄图像并使其形状相同是更好的方法。我试着用顶部的形状来拍摄部分的背景图像,但可以平铺图像的底部。这是我的html和css代码。请注意,我给出的代码是一个带有伪文本的示例代码

这是我的代码

CSS

@charset "utf-8";
/* CSS Document */
/* new clearfix */
.clearfix:after {
    visibility: hidden;
    display: block;
    font-size: 0;
    content: " ";
    clear: both;
    height: 0;
    }
* html .clearfix             { zoom: 1; } /* IE6 */
*:first-child+html .clearfix { zoom: 1; } /* IE7 */
body {
    background: #CCC;
    font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 62.5%;
}
h1 { font-size: 360%; }
h2 { font-size: 240%; }
h3 { font-size: 210%; }
h4 { font-size: 180%; }
h5 { 
    font-size: 160%;
    font-weight: bold;
}
h6 { font-size: 140%; }
#wrapper {
    width: 1100px;
    margin: 0 auto;
}
section {
    background: url(../img/bg.png) bottom repeat;
}
footer {
    background: -webkit-linear-gradient(top, #815b36, #3d2304);
    background: -moz-linear-gradient(top, #815b36, #3d2304);
    background: -ms-linear-gradient(top, #815b36, #3d2304);
    text-align: center;
    color: #FFF;
}
.links {
    width:100%;
    padding: 15px 100px;
}
.footerlinks {
    width: 25%;
    float: left;
    text-align: left;
}
.footerlinks a {
    text-decoration: none;
    color: #FFF;
    font-size: 120%;
}
.copywrite {
    font-size:120%;
    padding: 5px 0;
}

HTML

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Cafe Grinds</title>
<!---- Call External CSS---->
<link href="css/resetstyles.css" rel="stylesheet" type="text/css">
<link href="css/styles.css" rel="stylesheet" type="text/css">
<!----Call External File---->
<script src="js/modernizr-latest.js" type="text/javascript" > </script>
</head>
<body class="clearfix">
    <div id="wrapper">
  <header>
  </header>
<section>
    <div>
    <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>       
        <div class="delight">
        </div>
        <div class="comb">
        </div>
        <div class="reward">
        </div>
    </div>      
  </section>
<footer>
    <div class="links">
        <div class="footerlinks">
            <ul>
                <li> <h5>Customer Service</h5> </li>
                <li><a href="index.html">Privacy Policy</a></li>
                <li><a href="index.html">Shipping</a></li>
                <li><a href="index.html">FAQ's</a></li>
            </ul>
        </div>
        <div class="footerlinks">
            <ul>
                <li> <h5>Online</h5> </li>
                <li><a href="index.html">Products</a></li>
                <li><a href="index.html">Gift Cards</a></li>
                <li><a href="index.html">Accessories</a></li>
            </ul>
        </div>
        <div class="footerlinks">
            <ul>
                <li> <h5>Franchise</h5> </li>
                <li><a href="index.html">Site Submittal</a></li>
                <li><a href="index.html">Pricing</a></li>
                <li><a href="index.html">Apply</a></li>
            </ul>
        </div>
        <div class="footerlinks">
            <ul>
                <li> <h5>Careers</h5> </li>
                <li><a href="index.html">Opportunities</a></li>
                <li><a href="index.html">Cafe</a></li>
                <li><a href="index.html">Corporate</a></li>
            </ul>
        </div>
    </div>
    <div class="copywrite">
        &copy;Cafe Grind 2013
    </div>      
  </footer>
    </div>
</body>
</html>

这是上面代码中的布局

http://tinypic.com/r/2vao12x/5

我怎样才能平铺图像的底部,这样我就不会让整个图像重复。

请帮我解决这个问题。

要停止图像重复,只需更改CSS

       background: url(bg.png) bottom no-repeat;

对于幻灯片,我会为幻灯片创建一个容器

     <div id="lightboxdiv"> 
      <a href="" id="lbImagelink">
           <img id="lbImage" src="" align="absmiddle">
       </a>
    </div>  

然后使用一些JS来更改计时器事件上的图像源

        var lbImg= getelementbyid("lbImage");
        setTimeout(function(){lbImg.src =  imageurl ; },3000);

不确定这是你想做的,但希望它能帮助。。。