목차
回复讨论(解决方案)
웹 프론트엔드 HTML 튜토리얼 搞不懂了,难道又是BOM头?_html/css_WEB-ITnose

搞不懂了,难道又是BOM头?_html/css_WEB-ITnose

Jun 24, 2016 pm 12:23 PM

html css utf8



仔细看一下不难发现,登录名和密码输入栏不一边长,为啥?下拉菜单前面为啥有空格?(附代码)

<style type="text/css">body{font:12px Arial, Helvetica, sans-serif; color: #000; background-color: #EEF2FB; margin: 0px; }</style><link href="../css/skin.css" rel="stylesheet" type="text/css" /><body><table width="100%" border="0" cellpadding="0" cellspacing="0">	<tr>		<td width="17" height="29" valign="top" background="../images/mail_leftbg.gif"><img  src="/static/imghw/default1.png"  data-src="../images/left-top-right.gif"  class="lazy"      style="max-width:90%"  style="max-width:90%" / alt="搞不懂了,难道又是BOM头?_html/css_WEB-ITnose" ></td>		<td  valign="top" background="../images/content-bg.gif">		<table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">		<tr><td height="31"><div class="titlebt">用户管理</div></td></tr>		</table></td>		<td width="16" valign="top" background="../images/mail_rightbg.gif"><img  src="/static/imghw/default1.png"  data-src="../images/nav-right-bg.gif"  class="lazy"      style="max-width:90%"  style="max-width:90%" / alt="搞不懂了,难道又是BOM头?_html/css_WEB-ITnose" ></td>	</tr>	<tr>		<form method="POST" name="frmAdd" action=<?php echo $_SERVER['PHP_SELF'];?>>		<td height="71" valign="middle" background="../images/mail_leftbg.gif"> </td>		<td valign="top" bgcolor="#F7F8F9">		<table width="100%" height="138" border="0" cellpadding="0" cellspacing="0">		<tr>			<td valign="top"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">			<tr><td class="left_txt">当前位置:用户管理 >> 添加用户</td></tr>			<tr><td height="20"><table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">			<tr>				<td>				</td>			</tr></table></td></tr>			<tr><td><table width="100%" border="0" cellpadding="0" cellspacing="0">			</table></td></tr>			<tr><td> </td></tr>			<tr>            <td><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">				<tr><td class="left_bt2">    添加新用户</td></tr></table>			<tr>			<?php				include("../BOM.php");			?>				<td><table width="100%" border="0" cellspacing="0" cellpadding="0">				<tr>					<td width="20%" height="30" align="right" bgcolor="#f2f2f2" class="left_txt2">登录名:</td>					<td width="3%" bgcolor="#f2f2f2"> </td>					<td width="32%" height="30" bgcolor="#f2f2f2"><input type="test" name="LoginName" value="" size="30" /></td>					<td width="45%" height="30" bgcolor="#f2f2f2" class="left_txt">登录账号信息</td>				</tr>				<tr>					<td height="30" align="right" class="left_txt2">密码:</td>					<td> </td>					<td height="30"><input type="password" name="Password" value="" size="30" /></td>					<td height="30" class="left_txt">登录密码信息</td>				</tr>				<tr>					<td height="30" align="right" bgcolor="#f2f2f2" class="left_txt2">用户角色:</td>					<td bgcolor="#f2f2f2"> </td>					<td height="30" bgcolor="#f2f2f2"><?php include("../RoleSelect.php");?></td>					<td height="30" bgcolor="#f2f2f2" class="left_txt">用户角色信息</td>				</tr></table></td>			</tr></td></tr></table></td>		</tr>		<table width="100%" border="0" cellspacing="0" cellpadding="0">			<tr><td height="30" colspan="3"> </td></tr>            <tr>              <td width="50%" height="30" align="right"><input type="submit" name="btnAdd" value=" 确定 " /></td>              <td width="6%" height="30" align="right"> </td>              <td width="44%" height="30"><input type="reset" value=" 重写 " name="cancel" /></td>            </tr>            <tr><td height="30" colspan="3"> </td></tr>		</table>		<td background="../images/mail_rightbg.gif"> </td>		<tr>			<td valign="middle" background="../images/mail_leftbg.gif"><img  src="/static/imghw/default1.png"  data-src="../images/buttom_left2.gif"  class="lazy"      style="max-width:90%"  style="max-width:90%" / alt="搞不懂了,难道又是BOM头?_html/css_WEB-ITnose" ></td>			<td height="17" valign="top" background="../images/buttom_bgs.gif"><img  src="/static/imghw/default1.png"  data-src="../images/buttom_bgs.gif"  class="lazy"      style="max-width:90%"  style="max-width:90%" / alt="搞不懂了,难道又是BOM头?_html/css_WEB-ITnose" ></td>			<td background="..//mail_rightbg.gif"><img  src="/static/imghw/default1.png"  data-src="../images/buttom_right2.gif"  class="lazy"      style="max-width:90%"  style="max-width:90%" / alt="搞不懂了,难道又是BOM头?_html/css_WEB-ITnose" ></td>		</tr></table></td></form>	</tr></table></body>      
로그인 후 복사


@charset "utf8";.login_top_bg {	background-image: url(../images/login-top-bg.gif);	background-repeat: repeat-x;}.body {	background-color: #EEF2FB;	left: 0px;	top: 0px;	right: 0px;	bottom: 0px;}.login-buttom-bg {	background-image: url(../images/login-buttom-bg.gif);	background-repeat: repeat-x;}.login-buttom-txt {	font-family: Arial, Helvetica, sans-serif;	font-size: 10px;	color: #ABCAD3;	text-decoration: none;	line-height: 20px;}.login_txt {	font-family: Arial, Helvetica, sans-serif;	font-size: 12px;	line-height: 25px;	color: #333333;}.Submit {	font-family: Arial, Helvetica, sans-serif;	font-size: 12px;	color: #629DAE;	text-decoration: none;	background-image: url(../images/Submit_bg.gif);	background-repeat: repeat-x;}.login_bg {	background-image: url(../images/login_bg.jpg);	background-repeat: repeat-x;}.login_bg2 {	background-image: url(../images/login-content-bg.gif);	background-repeat: no-repeat;	background-position: right;}.admin_txt {	font-family: Arial, Helvetica, sans-serif;	font-size: 12px;	color: #FFFFFF;	text-decoration: none;	height: 38px;	width: 100%;	line-height: 38px;}.login_txt_bt {	font-family: Arial, Helvetica, sans-serif;	font-size: 14px;	line-height: 25px;	color: #666666;	font-weight: bold;}.admin_topbg {	background-image: url(../images/top-right.gif);	background-repeat: repeat-x;}.txt_bt {	font-family: Arial, Helvetica, sans-serif;	font-size: 12px;	line-height: 25px;	font-weight: bold;	color: #000000;	text-decoration: none;}.left_topbg {	background-image: url(../images/content-bg.gif);	background-repeat: repeat-x;}.admin_toptxt {	font-family: Arial, Helvetica, sans-serif;	font-size: 12px;	color: #4A8091;	height: 18px;	width: 100%;	overflow: hidden;	position: fixed;}.left_bt {	font-family: Arial, Helvetica, sans-serif;	font-size: 14px;	font-weight: bold;	color: #395a7b;}.left_bt2 {	font-family: Arial, Helvetica, sans-serif;	font-size: 12px;	line-height: 25px;	font-weight: bold;	color: #333333;}.titlebt {	font-size: 12px;	line-height: 26px;	font-weight: bold;	color: #000000;	background-image: url(../images/top_bt.jpg);	background-repeat: no-repeat;	display: block;	text-indent: 15px;	padding-top: 5px;}.left_txt {	font-family: Arial, Helvetica, sans-serif;	font-size: 12px;	line-height: 25px;	color: #666666;}.left_txt2 {	font-family: Arial, Helvetica, sans-serif;	font-size: 12px;	line-height: 25px;	color: #000000;}.view_title {	font-family: Arial, Helvetica, sans-serif;	font-size: 13px;	line-height: 25px;	color: #666666;	text-align: center;}.view_list {	font-family: Arial, Helvetica, sans-serif;	font-size: 13px;	line-height: 25px;	color: #000000;	text-align: center;}.view_page {	font-family: Arial, Helvetica, sans-serif;	font-size: 13px;	font-weight: bold;	line-height: 25px;	color: #191964;	text-align: center;}.view_checkbox {	font-family: Arial, Helvetica, sans-serif;	font-size: 13px;	line-height: 25px;	color: #000000;	text-align: left;}.nowtable {	background-color: #e1e5ee;	border-top-width: 1px;	border-right-width: 1px;	border-bottom-width: 1px;	border-left-width: 1px;	border-top-style: solid;	border-top-color: #bfc4ca;	border-right-color: #bfc4ca;	border-bottom-color: #bfc4ca;	border-left-color: #bfc4ca;}.left_txt3 {	font-family: Arial, Helvetica, sans-serif;	font-size: 12px;	line-height: 25px;	color: #003366;	text-decoration: none;}.left_ts {	font-family: Arial, Helvetica, sans-serif;	font-size: 12px;	line-height: 25px;	font-weight: bold;	color: #FF6600;}.line_table {	border: 1px solid #CCCCCC;}.sec1 {	CURSOR: hand;	COLOR: #000000;	font-family: Arial, Helvetica, sans-serif;	font-size: 12px;	line-height: 25px;	border: 1px solid #B5D0D9;	background-image: url(../images/right_smbg.jpg);	background-repeat: repeat-x;}.sec2 {	FONT-WEIGHT: bold;	CURSOR: hand;	COLOR: #000000;	font-family: Arial, Helvetica, sans-serif;	font-size: 12px;	line-height: 25px;	background-color: #e2e7ed;	border: 1px solid #e2e7ed;}.main_tab {	COLOR: #000000;	BACKGROUND-COLOR: #e2e7ed;	border: 1px solid #e2e7ed;}.MM a {	font-family: Arial, Helvetica, sans-serif;	font-size: 12px;	line-height: 26px;	color: #666666;	background-image: url(../images/menu_bg.gif);	background-repeat: no-repeat;	list-style-type: none;	list-style-image: none;}a:link {	font-size: 12px;	line-height: 25px;	color: #333333;	text-decoration: none;}a:hover {	font-size: 12px;	line-height: 25px;	color: #666666;	text-decoration: none;}a:visited {	font-size: 12px;	line-height: 25px;	color: #333333;	text-decoration: none;}.MM a:link {	font-family: Arial, Helvetica, sans-serif;	font-size: 12px;	line-height: 26px;	color: #666666;	background-image: url(../images/menu_bg.gif);	background-repeat: no-repeat;	list-style-type: none;	list-style-image: none;}
로그인 후 복사


回复讨论(解决方案)

是不是在chrome下才这样,测试了下,在IE9和FF下没有这种情况,在chrome下会发生这样的情形了,应该是chrome浏览器为type=password,自动加载了个样式:
input:not([type]), input[type="color"], input[type="email"], input[type="number"], input[type="password"], input[type="tel"], input[type="url"], input[type="text"] {
padding: 1px 0px;
}

而如果不是password,自动加载了另一个样式:
input, input[type="password"], input[type="search"], isindex {
-webkit-appearance: textfield;
padding: 1px;
。。。。。。。
}
这样就长短出来了。

是不是在chrome下才这样,测试了下,在IE9和FF下没有这种情况,在chrome下会发生这样的情形了,应该是chrome浏览器为type=password,自动加载了个样式:
input:not([type]), input[type="color"], input[type="email"], input[type="number"], input[type="password"], input[type="tel"], input[type="url"], input[type="text"] {
padding: 1px 0px;
}

而如果不是password,自动加载了另一个样式:
input, input[type="password"], input[type="search"], isindex {
-webkit-appearance: textfield;
padding: 1px;
。。。。。。。
}
这样就长短出来了。

我用的IE6和chrome测试的。。。


是不是在chrome下才这样,测试了下,在IE9和FF下没有这种情况,在chrome下会发生这样的情形了,应该是chrome浏览器为type=password,自动加载了个样式:
input:not([type]), input[type="color"], input[type="email"], input[type="number"], input[type="password"], input[type="tel"], input[type="url"], input[type="text"] {
padding: 1px 0px;
}

而如果不是password,自动加载了另一个样式:
input, input[type="password"], input[type="search"], isindex {
-webkit-appearance: textfield;
padding: 1px;
。。。。。。。
}
这样就长短出来了。

我用的IE6和chrome测试的。。。
为“” 加个样式:padding: 1px;就好了,至少chrome下能好,IE6没办法,我这边模拟不了。

为“” 加个样式:padding: 1px;就好了,至少chrome下能好,IE6没办法,我这边模拟不了。
不行,加了两边都会不齐,而且主要问题是那个下拉框,那个空了太多。

这样加:
1.那个input加个class “
2.在css文件中加:
.in-password {
padding: 1px;
}
在chrome中测试成功。这个是解决长短不一的。
3.你那个下拉框把html代码贴出来,你贴出来的是引入了个PHP文件。

这样加:
1.那个input加个class “
2.在css文件中加:
.in-password {
padding: 1px;
}
在chrome中测试成功。这个是解决长短不一的。
3.你那个下拉框把html代码贴出来,你贴出来的是引入了个PHP文件。

我是这样加的啊,也是chrome。。。效果就是相对于上面的框移到了中间位置,结果两边都多出来一点点

<!--RoleSelect.php:用户角色下拉框---------------><?php    	include_once("RoleClass.php");	//利用Role类的InitData()读取用户角色信息	$Role=new Role();       $roleid=$Role->RolePri($_SESSION["ss_user_id"]);	//循环将用户角色写入下拉框选项中	echo "<select name=RoleSelect>";	foreach($Role->mInforArray as $item)	{	       echo "<option value=".$item->RoleId.">".$item->RoleName."</option>";	}	echo "</select>"?>
로그인 후 복사
로그인 후 복사

<!--RoleClass.php:状态类---------------------------------><?phpclass Role{ 		var $mInforArray;			//状态基本信息数组	var $pRoleId=0;       var $mRoleArray;/********************************************* 函数:	InitData功能:				获取公文状态的基本信息,放入数组mInforArray中输入参数:			***********************************************/ function GetRoleIdFromUserId($pUserId){	require("sys_conf.inc");	require_once("DataBase.php");	$db=new DataBase($DBHOST,$DBUSER,$DBPWD,$DBNAME);		//获取权限信息	$db->SqlString="select * from user";	$db->SqlString=$db->SqlString." where UserId=$pUserId ";	$db->Query();		$this->mRoleArray=$db->mResultArray;       $this->pRoleId= $this->mRoleArray[0]->RoleId;      	$db->__destruct();}function RolePri($pUserId){     	require("sys_conf.inc");	require_once("DataBase.php");	$db=new DataBase($DBHOST,$DBUSER,$DBPWD,$DBNAME);		$this->GetRoleIdFromUserId($pUserId);	//获取基本信息	$db->SqlString="select * from role where RoleId < $this->pRoleId";	$db->Query();		$this->mInforArray=$db->mResultArray;	$db->__destruct();	}}?>
로그인 후 복사
로그인 후 복사


这样加:
1.那个input加个class “
2.在css文件中加:
.in-password {
padding: 1px;
}
在chrome中测试成功。这个是解决长短不一的。
3.你那个下拉框把html代码贴出来,你贴出来的是引入了个PHP文件。

我是这样加的啊,也是chrome。。。效果就是相对于上面的框移到了中间位置,结果两边都多出来一点点

<!--RoleSelect.php:用户角色下拉框---------------><?php    	include_once("RoleClass.php");	//利用Role类的InitData()读取用户角色信息	$Role=new Role();       $roleid=$Role->RolePri($_SESSION["ss_user_id"]);	//循环将用户角色写入下拉框选项中	echo "<select name=RoleSelect>";	foreach($Role->mInforArray as $item)	{	       echo "<option value=".$item->RoleId.">".$item->RoleName."</option>";	}	echo "</select>"?>
로그인 후 복사
로그인 후 복사

<!--RoleClass.php:状态类---------------------------------><?phpclass Role{ 		var $mInforArray;			//状态基本信息数组	var $pRoleId=0;       var $mRoleArray;/********************************************* 函数:	InitData功能:				获取公文状态的基本信息,放入数组mInforArray中输入参数:			***********************************************/ function GetRoleIdFromUserId($pUserId){	require("sys_conf.inc");	require_once("DataBase.php");	$db=new DataBase($DBHOST,$DBUSER,$DBPWD,$DBNAME);		//获取权限信息	$db->SqlString="select * from user";	$db->SqlString=$db->SqlString." where UserId=$pUserId ";	$db->Query();		$this->mRoleArray=$db->mResultArray;       $this->pRoleId= $this->mRoleArray[0]->RoleId;      	$db->__destruct();}function RolePri($pUserId){     	require("sys_conf.inc");	require_once("DataBase.php");	$db=new DataBase($DBHOST,$DBUSER,$DBPWD,$DBNAME);		$this->GetRoleIdFromUserId($pUserId);	//获取基本信息	$db->SqlString="select * from role where RoleId < $this->pRoleId";	$db->Query();		$this->mInforArray=$db->mResultArray;	$db->__destruct();	}}?>
로그인 후 복사
로그인 후 복사

PHP代码我看不懂的。。。。。。。你把这些代码生成后的html代码贴出来就行了。

密码框和文本框的默认宽度是不一样的 你要设置一个指定的宽度

select一样设置一个宽度比较好


	<select name=RoleSelect>	<option value= $item->RoleId > $item->RoleName</option>;	</select>
로그인 후 복사


大概就是这样子

兄弟别怪我吐槽。。。 看到table用来布局 我就。。。。

密码框和文本框的默认宽度是不一样的 你要设置一个指定的宽度

select一样设置一个宽度比较好

嗯呢,文本框密码框改过来了,但是select好像不行,这个是位置不对,大小无所谓。

兄弟别怪我吐槽。。。 看到table用来布局 我就。。。。

怎么啦 我不太懂,我都是网上找的直接下来用。

<style type="text/css">body{font:12px Arial, Helvetica, sans-serif; color: #000; background-color: #EEF2FB; margin: 0px; }//这里加  看-下行不select{    position: relative;    left: 0px;      top: 0px;      width: 185px;     }</style>觉得是样式问题呢
로그인 후 복사
로그인 후 복사

<style type="text/css">body{font:12px Arial, Helvetica, sans-serif; color: #000; background-color: #EEF2FB; margin: 0px; }//这里加  看-下行不select{    position: relative;    left: 0px;      top: 0px;      width: 185px;     }</style>觉得是样式问题呢
로그인 후 복사
로그인 후 복사


我已经解决了,把select写在php外面就好了。

我已经解决了,把select写在php外面就好了。
Good job

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

Video Face Swap

Video Face Swap

완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

HTML은 초보자를 위해 쉽게 배우나요? HTML은 초보자를 위해 쉽게 배우나요? Apr 07, 2025 am 12:11 AM

HTML은 간단하고 배우기 쉽고 결과를 빠르게 볼 수 있기 때문에 초보자에게 적합합니다. 1) HTML의 학습 곡선은 매끄럽고 시작하기 쉽습니다. 2) 기본 태그를 마스터하여 웹 페이지를 만들기 시작하십시오. 3) 유연성이 높고 CSS 및 JavaScript와 함께 사용할 수 있습니다. 4) 풍부한 학습 리소스와 현대 도구는 학습 과정을 지원합니다.

HTML, CSS 및 JavaScript의 역할 : 핵심 책임 HTML, CSS 및 JavaScript의 역할 : 핵심 책임 Apr 08, 2025 pm 07:05 PM

HTML은 웹 구조를 정의하고 CSS는 스타일과 레이아웃을 담당하며 JavaScript는 동적 상호 작용을 제공합니다. 세 사람은 웹 개발에서 의무를 수행하고 화려한 웹 사이트를 공동으로 구축합니다.

HTML의 시작 태그의 예는 무엇입니까? HTML의 시작 태그의 예는 무엇입니까? Apr 06, 2025 am 12:04 AM

anexampleStartingtaginhtmlis, whithbeginsaparagraph.startingtagsareessentialinhtmlastheyinitiate rements, definetheirtypes, andarecrucialforstructurituringwebpages 및 smanstlingthedom.

HTML, CSS 및 JavaScript 이해 : 초보자 안내서 HTML, CSS 및 JavaScript 이해 : 초보자 안내서 Apr 12, 2025 am 12:02 AM

WebDevelopmentReliesonHtml, CSS 및 JavaScript : 1) HtmlStructuresContent, 2) CSSSTYLESIT, 및 3) JAVASCRIPTADDSINGINTERACTIVITY, BASISOFMODERNWEBEXPERIENCES를 형성합니다.

웹 주석에서 y 축 위치의 적응 형 레이아웃을 구현하는 방법은 무엇입니까? 웹 주석에서 y 축 위치의 적응 형 레이아웃을 구현하는 방법은 무엇입니까? Apr 04, 2025 pm 11:30 PM

웹 주석 기능에 대한 Y 축 위치 적응 알고리즘이 기사는 Word 문서와 유사한 주석 기능을 구현하는 방법, 특히 주석 간격을 다루는 방법을 모색합니다 ...

Gitee Pages 정적 웹 사이트 배포 실패 : 단일 파일 문제를 해결하고 해결하는 방법 404 오류? Gitee Pages 정적 웹 사이트 배포 실패 : 단일 파일 문제를 해결하고 해결하는 방법 404 오류? Apr 04, 2025 pm 11:54 PM

GiteEpages 정적 웹 사이트 배포 실패 : 404 오류 문제 해결 및 해결시 Gitee ...

CSS3 및 JavaScript를 사용하여 클릭 후 주변 사진을 흩어지고 확대하는 효과를 얻는 방법은 무엇입니까? CSS3 및 JavaScript를 사용하여 클릭 후 주변 사진을 흩어지고 확대하는 효과를 얻는 방법은 무엇입니까? Apr 05, 2025 am 06:15 AM

이미지를 클릭 한 후 주변 이미지를 산란 및 확대하는 효과를 얻으려면 많은 웹 디자인이 대화식 효과를 달성해야합니다. 특정 이미지를 클릭하여 주변을 만들 수 있습니다 ...

HTML, CSS 및 JavaScript : 웹 개발자를위한 필수 도구 HTML, CSS 및 JavaScript : 웹 개발자를위한 필수 도구 Apr 09, 2025 am 12:12 AM

HTML, CSS 및 JavaScript는 웹 개발의 세 가지 기둥입니다. 1. HTML은 웹 페이지 구조를 정의하고 등과 같은 태그를 사용합니다. 2. CSS는 색상, 글꼴 크기 등과 같은 선택기 및 속성을 사용하여 웹 페이지 스타일을 제어합니다.

See all articles