白骑士的CSS教学实战项目篇 6.5 企业官网的CSS布局

61 篇文章 0 订阅
30 篇文章 0 订阅

        在设计企业官网的CSS布局时,需要确保页面不仅美观而且功能性强。以下是一个详细的CSS布局示例,涵盖了常见的网页部分,包括导航栏、英雄部分、关于我们、服务或产品、客户评价、联系方式和页脚。

页面结构

        结构示例:

  • 顶部导航栏:包含公司标志和导航链接。
  • 英雄部分:突出显示公司的核心信息或促销内容。
  • 关于我们:介绍公司背景和团队。
  • 服务或产品:展示公司的服务或产品。
  • 客户评价:展示客户的反馈和评价。
  • 联系方式:提供联系信息和表单。
  • 页脚:包含版权信息和其他辅助链接。

CSS样式设计

顶部导航栏

        HTML:

<header class="navbar">
    <div class="container">
        <h1 class="logo">CompanyName</h1>

        <nav>
            <ul>
                <li><a href="#home">Home</a></li>
                <li><a href="#about">About Us</a></li>
                <li><a href="#services">Services</a></li>
                <li><a href="#testimonials">Testimonials</a></li>
                <li><a href="#contact">Contact</a></li>
            </ul>
        </nav>
    </div>
</header>

        CSS:

.navbar {
    background-color: #333;
    color: #fff;
    padding: 15px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar .container {
    width: 90%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar .logo {
    font-size: 24px;
    font-weight: bold;
}

.navbar nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.navbar nav ul li {
    margin-left: 20px;
}

.navbar nav ul li a {
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s;
}

.navbar nav ul li a:hover {
    color: #f39c12;
}

英雄部分

        HTML:

<section class="hero">
    <div class="container">
        <h2 class="hero-title">Welcome to CompanyName</h2>
        <p class="hero-subtitle">Your Trusted Partner in [Industry]</p>
        <a href="#services" class="cta-button">Discover Our Services</a>
    </div>
</section>

        CSS:

.hero {
    background: url('hero-bg.jpg') no-repeat center center/cover;
    color: #fff;
    text-align: center;
    padding: 100px 0;
}

.hero .container {
    width: 80%;
    margin: 0 auto;
}

.hero-title {
    font-size: 48px;
    margin: 0;
}

.hero-subtitle {
    font-size: 24px;
    margin: 10px 0;
}

.cta-button {
    display: inline-block;
    padding: 15px 30px;
    background-color: #f39c12;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-size: 18px;
    transition: background-color 0.3s;
}

.cta-button:hover {
    background-color: #e67e22;
}

关于我们

        HTML:

<section id="about" class="about-us">
    <div class="container">
        <h2>About Us</h2>

        <p>At CompanyName, we are dedicated to [core mission or vision]. Our team of experts brings years of experience in [industry], working tirelessly to deliver the best solutions for our clients.</p>

        <div class="team">
            <div class="team-member">
                <img src="team1.jpg" alt="Team Member">
                <h3>John Doe</h3>
                <p>CEO & Founder</p>
            </div>

            <div class="team-member">
                <img src="team2.jpg" alt="Team Member">
                <h3>Jane Smith</h3>
                <p>Lead Designer</p>
            </div>

            <!-- More team members -->
        </div>
    </div>
</section>

        CSS:

.about-us {
    padding: 60px 0;
    background-color: #f4f4f4;
    text-align: center;
}

.about-us h2 {
    font-size: 36px;
    margin-bottom: 20px;
}

.about-us p {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 40px;
}

.team {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
}

.team-member {
    width: 30%;
    text-align: center;
    margin-bottom: 20px;
}

.team-member img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-bottom: 10px;
}

.team-member h3 {
    font-size: 20px;
    margin: 0;
}

.team-member p {
    font-size: 16px;
    color: #777;
}

服务或产品

        HTML:

<section id="services" class="services">
    <div class="container">
        <h2>Our Services</h2>

        <div class="service-list">
            <div class="service-item">
                <img src="service1.jpg" alt="Service">
                <h3>Service One</h3>
                <p>We provide high-quality service one to meet your needs.</p>
            </div>

            <div class="service-item">
                <img src="service2.jpg" alt="Service">
                <h3>Service Two</h3>
                <p>Our service two is designed to help you achieve your goals.</p>
            </div>

            <!-- More services -->
        </div>
    </div>
</section>

        CSS:

.services {
    padding: 60px 0;
    background-color: #ffffff;
    text-align: center;
}

.services h2 {
    font-size: 36px;
    margin-bottom: 20px;
}

.service-list {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

.service-item {
    width: 30%;
    background-color: #f9f9f9;
    padding: 20px;
    margin: 10px 0;
    text-align: center;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.service-item img {
    width: 80px;
    height: 80px;
    margin-bottom: 10px;
}

.service-item h3 {
    font-size: 24px;
    margin: 10px 0;
}

.service-item p {
    font-size: 16px;
    color: #666;
}

客户评价

        HTML:

<section id="testimonials" class="testimonials">
    <div class="container">
        <h2>What Our Clients Say</h2>

        <div class="testimonial-list">
            <div class="testimonial-item">
                <p>"CompanyName provided exceptional service and support. Highly recommend!"</p>
                <h3>Alex Johnson</h3>
                <p>CEO, Example Corp</p>
            </div>

            <div class="testimonial-item">
                <p>"The team at CompanyName is professional and dedicated. Great experience!"</p>
                <h3>Emily Davis</h3>
                <p>Founder, Startup Inc</p>
            </div>

            <!-- More testimonials -->
        </div>
    </div>
</section>

        CSS:

.testimonials {
    padding: 60px 0;
    background-color: #f4f4f4;
    text-align: center;
}

.testimonials h2 {
    font-size: 36px;
    margin-bottom: 20px;
}

.testimonial-list {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
}

.testimonial-item {
    width: 45%;
    background-color: #fff;
    padding: 20px;
    margin: 10px 0;
    border-left: 5px solid #007bff;
    border-radius: 8px;
}

.testimonial-item p {
    font-size: 18px;
    line-height: 1.6;
    margin: 0 0 10px;
}

.testimonial-item h3 {
    font-size: 20px;
    margin: 0;
}

.testimonial-item p:last-child {
    color: #777;
    font-size: 16px;
}

联系方式

        HTML:

<section id="contact" class="contact">
    <div class="container">
        <h2>Contact Us</h2>

        <form class="contact-form">
            <label for="name">Name:</label>
            <input type="text" id="name" name="name" required>
            <label for="email">Email:</label>
            <input type="email" id="email" name="email" required>
            <label for="message">Message:</label>
            <textarea id="message" name="message" rows="5" required></textarea>
            <button type="submit" class="submit-button">Send Message</button>
        </form>

        <div class="contact-info">
            <p>Address: 123 Business Rd, City, Country</p>
            <p>Phone: (123) 456-7890</p>
            <p>Email: contact@companyname.com</p>
        </div>
    </div>
</section>

        CSS:

.contact {
    padding: 60px 0;
    background-color: #ffffff;
    text-align: center;
}

.contact h2 {
    font-size: 36px;
    margin-bottom: 20px;
}

.contact-form {
    max-width: 600px;
    margin: 0 auto;
    text-align: left;
}

.contact-form label {
    display: block;
    font-size: 18px;
    margin-bottom: 5px;
}

.contact-form input,

.contact-form textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.contact-form textarea {
    resize: vertical;
}

.submit-button {
    display: inline-block;
    padding: 15px 30px;
    background-color: #007bff;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-size: 18px;
    transition: background-color 0.3s;
}

.submit-button:hover {
    background-color: #0056b3;
}

.contact-info {
    margin-top: 30px;
}

.contact-info p {
    font-size: 16px;
    color: #333;
}

页脚

        HTML:

<footer class="footer">
    <div class="container">
        <div class="footer-left">
            <p>&copy; 2024 CompanyName. All rights reserved.</p>
        </div>

        <div class="footer-right">
            <ul>
                <li><a href="#">Privacy Policy</a></li>
                <li><a href="#">Terms of Service</a></li>
                <li><a href="#">Sitemap</a></li>
            </ul>
        </div>
    </div>
</footer>

        CSS:

.footer {
    background-color: #333;
    color: #fff;
    padding: 20px 0;
    text-align: center;
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    margin: 0 auto;
}

.footer-left {
    font-size: 14px;
}

.footer-right ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.footer-right ul li {
    margin-left: 15px;
}

.footer-right ul li a {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.footer-right ul li a:hover {
    color: #f39c12;
}

总结

        设计企业官网的CSS布局时,需要注意以下几点:

  • 用户体验:设计要易于导航,确保信息易于查找。清晰的布局和一致的设计语言能够提升用户体验。
  • 响应式设计:利用媒体查询和弹性布局,确保网站在各种设备上都有良好的显示效果。
  • 品牌形象:通过颜色、字体和图像等元素来体现公司的品牌形象和核心价值。
  • 功能性:确保所有功能模块(如联系表单、服务展示)正常运作,并且易于用户使用。

        这些示例CSS样式可以作为构建企业官网的基础,之后可以根据公司的品牌需求和具体功能进一步调整和扩展。

  • 5
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

白骑士所长

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值