0

0

如何将表格水平排列并向右移动?

碧海醫心

碧海醫心

发布时间:2024-11-03 21:27:02

|

1000人浏览过

|

来源于php中文网

原创

如何将表格水平排列并向右移动?

如何让表格横向排列

你的问题是关于让表格横向排列,而不是让表格向右移动。为了解决这个问题,你可以使用CSS中的 float 属性。

水平排列表格

要在水平方向排列表格,请将以下CSS添加到的表格中:

table {
    float: left;
}

这将使表格水平排列在页面上。

向右移动新生成的表格

要向右移动新生成的表格,请使用 margin-left 属性。将以下CSS添加到新生成的表格中:

简单AI
简单AI

搜狐推出的AI图片生成社区

下载
.box {
    margin-right: 840px;
}

这将使新生成的表格向右移动 840px。

解决其他问题

此外,你提到了其他两个问题:

  • 在下标“∨”位置改变。这似乎是 CSS 或 JavaScript 中的一个问题。请检查你的代码是否存在任何错误或冲突。
  • 下标“∨”和其他元素在点击后被遮挡。这可以通过调整元素的位置和大小来解决。你可以使用 position、 top、 left、 width 和 height 属性。

完整代码

以下是一个结合上述解决方案的完整代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Daily report generator</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box {
            float: right;
            margin-right: 840px;
            margin-top: 200px;
            width: 10px;
            position: absolute;
        }

        .title {
            background: linear-gradient(#141e30);
        }

        table {
            height: 200px;
            width: 200px;
            font-size: 12px;
            text-align: center;
            float: left;
            margin: 10px;
            font-family: arial;
        }

        .dash_border {
            font-family: Arial;
            font-size: 1px;
            line-height: 1px;
            font-weight: bold;
            color: pink;
            padding: 0.1px;
            border: 0.1px dashed #FF5722;
            background:
                linear-gradient(to top, #ccc, 10px, transparent 1px),
                linear-gradient(to right, ccc, 10px, transparent 1px),
                linear-gradient(to bottom, ccc, 10px, transparent 1px),
                linear-gradient(to left, ccc, 10px, transparent 1px);
            background-origin: border-box;
        }

        .button_sty { /*确定*/
            float: right;
            margin-right: -780px;
            position: relative;
            top: 120px;
            margin-top: -200px;
            font-size: 13px;
            background: -webkit-linear-gradient(left, #03e9f4, transparent);
            color: #03e9f4;
        }

        .add_sty { /*∨*/
            float: right;
            margin-right: 515px;
            font-size: 20px;
            top: 12px;
            position: relative;
            height: 28px;
            width: 30px;
            margin-top: -380px;
        }

        /*----------------------------------输入框----------------------------------------*/
        a {
            text-decoration: none;
        }

        input {
            background: transparent;
            border: 0;
            outline: none;
        }

        .loginBox {
            width: 400px;
            height: 364px;
            background-color: #00000060;
            margin: auto;
            border-radius: 10px;
            box-shadow: 0 15px 25px 0 rgba(0, 0, 0, .6);
            padding: 40px;
            box-sizing: border-box;
            float: auto;
            position: absolute;
        }

        h2 {
            text-align: center;
            color: aliceblue;
            margin-bottom: 30px;
            font-family: 'Courier New', Courier, monospace;
        }

        .item {
            height: 45px;
            border-bottom: 1px solid #fff;
            margin-bottom: 40px;
            position: relative;
        }

        .item input {
            width: 100%;
            height: 100%;
            color: #fff;
            padding-top: 20px;
            box-sizing: border-box;
        }

        .item input:focus + label,
        .item input:valid + label {
            top: 0px;
            font-size: 2px;
        }

        .item label {
            position: absolute;
            left: 0;
            top: 12px;
            transition: all 0.5s linear;
        }

        .btn {
            padding: 10px 20px;
            margin-top: 30px;
            color: #03e9f4;
            position: relative;
            overflow: hidden;
            text-transform: uppercase;
            letter-spacing: 2px;
            left: 35%;
        }

        .btn:hover {
            border-radius: 5px;
            color: #fff;
            background: #03e9f4;
            box-shadow: 0 0 5px 0 #03e9f4,
                0 0 25px 0 #03e9f4,
                0 0 50px 0 #03e9f4,
                0 0 100px 0 #03e9f4;
            transition: all 1s linear;
        }

        .btn > span {
            position: absolute;
        }

        .btn > span:nth-child(1) {
            width: 100%;
            height: 2px;
            background: -webkit-linear-gradient(left, transparent, #03e9f4);
            left: -100%;
            top: 0px;
            animation: line1 1s linear infinite;
        }

        @keyframes line1 {

            50%,
            100% {
                left: 100%;
            }
        }

        .btn > span:nth-child(2) {
            width: 2px;
            height: 100%;
            background: -webkit-linear-gradient(top, transparent, #03e9f4);
            right: 0px;
            top: -100%;
            animation: line2 1s 0.25s linear infinite;
        }

        @keyframes line2 {

            50%,
            100% {
                top: 100%;
            }
        }

        .btn > span:nth-child(3) {
            width: 100%;
            height: 2px;
            background: -webkit-linear-gradient(left, #03e9f4, transparent);
            left: 100%;
            bottom: 0px;
            animation: line3 1s 0.75s linear infinite;
        }

        @keyframes line3 {

            50%,
            100% {
                left: -100%;
            }
        }

        .btn > span:nth-child(4) {
            width: 2px;
            height: 100%;
            background: -webkit-linear-gradient(top, transparent, #03e9f4);
            left: 0px;
            top: 100%;
            animation: line4 1s 1s linear infinite;
        }

        @keyframes line4 {
            50%,
            100% {
                top: -100%;
            }
        }

        body {
            height: 100vh;
            background: linear-gradient(#141e30, #243b55);
            display: flex;
            justify-content: center;

热门AI工具

更多
DeepSeek
DeepSeek

幻方量化公司旗下的开源大模型平台

豆包大模型
豆包大模型

字节跳动自主研发的一系列大型语言模型

通义千问
通义千问

阿里巴巴推出的全能AI助手

腾讯元宝
腾讯元宝

腾讯混元平台推出的AI助手

文心一言
文心一言

文心一言是百度开发的AI聊天机器人,通过对话可以生成各种形式的内容。

讯飞写作
讯飞写作

基于讯飞星火大模型的AI写作工具,可以快速生成新闻稿件、品宣文案、工作总结、心得体会等各种文文稿

即梦AI
即梦AI

一站式AI创作平台,免费AI图片和视频生成。

ChatGPT
ChatGPT

最最强大的AI聊天机器人程序,ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。

相关专题

更多
css中float用法
css中float用法

css中float属性允许元素脱离文档流并沿其父元素边缘排列,用于创建并排列、对齐文本图像、浮动菜单边栏和重叠元素。想了解更多float的相关内容,可以阅读本专题下面的文章。

592

2024.04.28

C++中int、float和double的区别
C++中int、float和double的区别

本专题整合了c++中int和double的区别,阅读专题下面的文章了解更多详细内容。

105

2025.10.23

CSS position定位有几种方式
CSS position定位有几种方式

有4种,分别是静态定位、相对定位、绝对定位和固定定位。更多关于CSS position定位有几种方式的内容,可以访问下面的文章。

83

2023.11.23

margin在css中是啥意思
margin在css中是啥意思

在CSS中,margin是一个用于设置元素外边距的属性。想了解更多margin的相关内容,可以阅读本专题下面的文章。

458

2023.12.18

Golang 实际项目案例:从需求到上线
Golang 实际项目案例:从需求到上线

《Golang 实际项目案例:从需求到上线》以真实业务场景为主线,完整覆盖需求分析、架构设计、模块拆分、编码实现、性能优化与部署上线全过程,强调工程规范与实践决策,帮助开发者打通从技术实现到系统交付的关键路径,提升独立完成 Go 项目的综合能力。

1

2026.02.26

Golang Web 开发路线:构建高效后端服务
Golang Web 开发路线:构建高效后端服务

《Golang Web 开发路线:构建高效后端服务》围绕 Go 在后端领域的工程实践,系统讲解 Web 框架选型、路由设计、中间件机制、数据库访问与接口规范,结合高并发与可维护性思维,逐步构建稳定、高性能、易扩展的后端服务体系,帮助开发者形成完整的 Go Web 架构能力。

3

2026.02.26

Golang 并发编程专题:掌握多核时代的核心技能
Golang 并发编程专题:掌握多核时代的核心技能

《Golang 并发编程专题:掌握多核时代的核心技能》系统讲解 Go 在并发领域的设计哲学与实践方法,深入剖析 goroutine、channel、调度模型与并发安全机制,结合真实场景与性能思维,帮助开发者构建高吞吐、低延迟、可扩展的并发程序,全面提升多核时代的工程能力。

5

2026.02.26

batoto漫画官网入口与网页版访问指南
batoto漫画官网入口与网页版访问指南

本专题系统整理batoto漫画官方网站最新可用入口,涵盖最新官网地址、网页版登录页面及防走失访问方式说明,帮助用户快速找到batoto漫画官方平台,稳定在线阅读各类漫画内容。

353

2026.02.25

Steam官网正版入口与注册登录指南_新手快速进入游戏平台方法
Steam官网正版入口与注册登录指南_新手快速进入游戏平台方法

本专题系统整理Steam官网最新可用入口,涵盖网页版登录地址、新用户注册流程、账号登录方法及官方游戏商店访问说明,帮助新手玩家快速进入Steam平台,完成注册登录并管理个人游戏库。

77

2026.02.25

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
Sass 教程
Sass 教程

共14课时 | 0.9万人学习

Bootstrap 5教程
Bootstrap 5教程

共46课时 | 3.5万人学习

CSS教程
CSS教程

共754课时 | 36.8万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号