gpt4 book ai didi

html - 如何让出现在表格边框和表格背景之间并让页面背景透出的烦人的1px边框消失?

转载 作者:行者123 更新时间:2023-11-28 19:16:03 26 4
gpt4 key购买 nike

一个 1px 的“边框”出现在边框内,该边框基本上是显示的页面背景,即使表格有设置的背景颜色。它基本上出现在边界旁边。

我尝试增加边框的宽度,希望它能覆盖它。

这是我这边的样子:[我这边的样子][1]

这是我的 css 文件,后面是我想在其中使用它的函数:

    width: 1000px;
margin-left: auto;
margin-right: auto;
}
#title{
height: 250px;
width: 996px;
border: 2px solid #0000ff;
margin-left: auto;
margin-right: auto;
background-color: #55ff55;
text-align: center;
}
#lefty{
height: 600px;
width: 246px;
border: 2px solid #ff0000;
margin-right: auto;
background-color: #ff5555;
padding: 10px;
}
#righty{
height: 600px;
width: 706px;
border: 2px solid #00ff00;
margin-left: auto;
margin-top: -624px;
background-color: #5555ff;
padding: 10px;
}
.menu{
display: block;
height : 20px;
width: 236px;
text-align: center;
font-size: 14px;
font-weight: bold;
color: black;
background-color: #bb0000;
text-decoration: none;
}
.menu:hover{
color: white;
background-color: red;
}

table, td, th{
border: 3px solid black;
}
table{
border-collapse: collapse;
}
}

function MenutIr($x)
{
echo '<table align="center">';
foreach($x as $index => $ertek)
{
echo '<tr><td>';
echo '<a href=?menu='.$index.' class ="menu">'.$ertek.'</a>';
echo '</td></tr>';
}
echo '</table>';
}

EDIT: I couldn't make the snippet work but here is a working version of it:
<?php
session_start();
?>
<!DOCTYPE>
<html>
<html lang = "hu">
<head>
<title> </title>
<meta charset = "UTF-8">
<style>body{
width: 1000px;
margin-left: auto;
margin-right: auto;
}
#title{
height: 250px;
width: 996px;
border: 2px solid #0000ff;
margin-left: auto;
margin-right: auto;
background-color: #55ff55;
text-align: center;
}
#lefty{
height: 600px;
width: 246px;
border: 2px solid #ff0000;
margin-right: auto;
background-color: #ff5555;
padding: 10px;
}
#righty{
height: 600px;
width: 706px;
border: 2px solid #00ff00;
margin-left: auto;
margin-top: -624px;
background-color: #5555ff;
padding: 10px;
}
.menu{
display: block;
height : 20px;
width: 236px;
text-align: center;
font-size: 14px;
font-weight: bold;
color: black;
background-color: #bb0000;
text-decoration: none;
}
.menu:hover{
color: white;
background-color: red;
}

table, td, th{
border: 3px solid black;
}
table{
border-collapse: collapse;
}
}</style>
</head>
<body>
<?php
$menu[1] = "Beolvas";
$menu[2] = "Tényező";
$menu[3] = "Oszt";
?>
<?php
function Debug($x)
{
echo '<pre>';
print_r($x);
echo '</pre>';
}
function MenutIr($x)
{
echo '<table align="center">';

/*
vegigmegy a tombon a
beirt indexek sorrendje szerint
index - index
ertek - a tombben hasznalt ertek
*/
foreach($x as $index => $ertek)
{
/*
table row, table data - minden elemet kulon sorban jelenit meg
*/
echo '<tr><td>';
echo '<a href=?menu='.$index.' class ="menu">'.$ertek.'</a>';
echo '</td></tr>';
}
echo '</table>';
}

function Olvas(&$a)
{
if(!isset($_POST["a"]) || $_POST["a"]==""|| !is_numeric($_POST["a"]))
{
/*Urlap*/
echo '<form name="Olvas" action="" method="post">';
echo 'a = ';
echo '<input name="a" type="number" min ="1" size="3"<br><br>';
echo '<input name="gomb" type="submit" value="Mehet">';
echo '</form>';
return 0;
}
else
{

$a = $_POST["a"];
$_SESSION["a"] = $a;
return 1;
}
}
function Oszt($a)
{
$d=1;
for($d=1; $d <= $a; $d++)
{
if($a%$d==0)
{
echo "$d ";
}
}
}

function Tenyezo($a)
{
$d=2;
echo '<table>';
while($a>1)
{
if($a%$d==0)
{
echo '<tr><td style= "text-align:right; border-left-style:hidden; border-top-style:hidden; border-bottom-style:hidden;">'.$a.'</td><td style= "text-align:left; border-right-style:hidden; border-top-style:hidden; border-bottom-style:hidden;">'.$d.'</td></tr>';
$a = $a/$d;
}
else
{
$d++;
}
}
echo '<tr><td style= "text-align:right; border-left-style:hidden; border-top-style:hidden; border-bottom-style:hidden;">1</td><td style= "text-align:left; border-right-style:hidden; border-top-style:hidden; border-bottom-style:hidden;"></td></tr>';
echo '</table>';
}
?>
<div id = "title"> Php kezdetek </div>
<div id = "lefty">
<?php
MenutIr($menu);
?>
</div>
<div id = "righty">
<?php

/*ha nem volt kattintas a menure*/
$a = 0;
$b = 0;
if(!isset($_GET["menu"]))
{
Debug($menu);
}
else
{
switch($_GET["menu"])
{
case 1: //kattintas az elso mezon
echo $menu[1].'<br>';
if(Olvas($a))
{
echo "a=$a<br>";
}
break;
case 2: //kattintas a masodik mezon
echo $menu[2].'<br>';
if(!isset($_SESSION["a"]))
{
echo "Nincs mit osszeadni<br>";
}
else
{
$a=$_SESSION["a"];
Tenyezo($a);
}
break;
case 3: //kattintas a harmadik mezon
echo $menu[3].'<br>';
if(!isset($_SESSION["a"]))
{
echo "Nincs mit osszeadni<br>";
}
else
{
$a=$_SESSION["a"];
Oszt($a);
}
break;
case 4: //kattintas a harmadik mezon
echo $menu[4].'<br>';
break;
}
}
?>
</div>
</body>
</html>


[1]: /image/3Ki0v.png

最佳答案

您需要添加“cellpadding='0'”以及“border-collapse: collapse;”在你的表格标签中是这样的:

echo "<table align='center' cellpadding='0'>";

关于html - 如何让出现在表格边框和表格背景之间并让页面背景透出的烦人的1px边框消失?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58317356/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com