html+css+js文章模板

图片    源代码在图片后面,点赞加关注,谢谢😄

5287ce476b2f47d28e3d25b866c9dfcb.jpg

 源代码

<!DOCTYPE html>

<html lang="zh">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>新闻界面</title>

    <style>

        body {

            background-color: #f0f0f0;

            font-family: Arial, sans-serif;

        }

        .news-item {

            background-color: white;

            margin: 20px auto;

            padding: 20px;

            border-radius: 10px;

            box-shadow: 0 4px 6px rgba(0,0,0,0.1);

            max-width: 800px;

            width: 95%;

        }

        .news-title {

            text-align: center;

            margin-bottom: 20px;

            color: #333;

        }

        .news-author {

            color: #777;

            margin-bottom: 10px;

        }

        .news-content {

            margin-bottom: 20px;

        }

        .news-image {

            display: block;

            margin: auto;

            max-width: 100%;

        }

        .news-video {

            width: 100%;

            height: auto;

        }

        .news-actions {

            display: flex;

            justify-content: center;

            gap: 10px;

        }

        .action-button {

            background-color: red;

            color: white;

            border: none;

            border-radius: 5px;

            padding: 5px 10px;

            cursor: pointer;

            margin:10px auto;

            box-shadow: 0 2px 4px rgba(0,0,0,0.1);

        }

        .separator {

            width: 95%;

            margin: 30px;

            border-top: 1px solid #ddd;

        }

    </style>

</head>

<body>

    <div class="news-item">

        <h2 class="news-title">新闻标题</h2>

        <p class="news-author">作者: 张三</p>

        <p>发布日期: 2023-04-01</p>

        <div class="news-content">

            <img src="https://via.placeholder.com/500x300" alt="新闻图片" class="news-image">

            <p>新闻内容...</p>

            <!-- 假设这是视频 -->

            <video controls class="news-video">

                <source src="movie.mp4" type="video/mp4">

            </video>

        </div>

        <div class="news-actions">

            <button class="action-button" id="like-btn">点赞</button>

            <button class="action-button" id="follow-btn">关注</button>

            <button class="action-button" id="save-btn">收藏</button>

        </div>

    </div>

    <div class="separator"></div>

    <!-- 可以重复以上结构添加更多新闻条目 -->

 

    <script>

        document.getElementById('like-btn').addEventListener('click', function() {

            alert('点赞');

        });

        document.getElementById('follow-btn').addEventListener('click', function() {

            alert('关注');

        });

        document.getElementById('save-btn').addEventListener('click', function() {

            alert('收藏');

        });

    </script>

</body>

</html>

  • 14
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值