HTML CSS - Undraggable图像和整洁代码

时间:2016-01-13 06:09:19

标签: javascript jquery html css

我需要帮助我正在开发一个新的网络开发,但我如何使图像不可分割,我已经使它无法打开,但当我选择所有文本和整个页面和这个图像时,它使处于可拖动的状态帮助

drag image

我需要建议或批评。是我的工作吗?它干净还是什么?谢谢大家:)



body {
  background-color: #CEF6CE;
}
* {
  font-family: 'Helvetica', 'Arial', sans-serif;
  margin: 0px;
}
.wrapper {
	background-color: white;
	height: 642px;
	width: 900px;
	margin: 0 auto;
}
.login {
	background-color: red;
	width: 235px;
	height: 295px;
	margin-top: 150px;
	margin-left: 545px;
	margin-right: 200px;
	position: fixed;
	font-size: 20px;
}
.loginform {
	margin-top: 25px;
}
.txts td {
	white-space: nowrap;
}
.footer {
	background-color: #4A4A4A;
	width: 100%;
	height: 25px;
	position: absolute;
	margin: 0 auto;
	bottom: 0;
	font-size: 11px;
}
.copyright {
	background-color: transparent;
	position: absolute;
	color: #E0E0E0;
	margin-left: 1000px;
}
a:link {
	text-decoration: none;
}
a:hover {
	text-decoration: underline;
}
button.loginBtn {
	width: 80px;
    height: 30px;
    font-weight: bold;
    color: white;
    background-color: #3399ff;
    border-color: #3399ff;
    border-radius: 3px;

}
button.loginBtn:hover {
	background-color: #1a8cff;
}
a.frgtPass {
	text-decoration: none;
	color: red;
}
a.frgtPass:hover {
	color: #ff6666;
}
p.frmt {
	color: #757575;
}
p.frmtnum {
	color: #8898B5;
}
input.inputs {
	border-radius: 3px;
	border: 1px solid #BFBFBF;
	height: 20px;
	width: 100%;
	position: relative;
}
img.logo {
	pointer-events: none;
	margin-top: 150px;
	margin-left: 75px;
	position: absolute;
	-khtml-user-select: none;
    -o-user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    user-select: none;
}

<!doctype html>
<html>
<head>
	<title>Insight - Saint Vincent High School Community Portal</title>
	<link rel="stylesheet" type="text/css" href="css\main_design.css">
</head>

<body>
<div class="main">
	<div class="wrapper">
		<img class="logo" src="img/smple.png" style="width:304px;height:228px;">
		<div class="login">
			<table class="txts">
				<tr>
					<td><p>Saint Vincent High School</p></td>
				</tr>
				<tr>
					<td><p>Online Community Portal</p></td>
				</tr>
			</table>
			<div class="loginform">
				<table>
					<tr>
						<td><p style="font-size:15px">Username / ID</p></td>
					</tr>
					<tr>
						<td><input type="text" class="inputs" name="username" size="30"></td>
					</tr>
					<tr>
						<td><p style="font-size:15px">Password</p></td>
					</tr>
					<tr>
						<td><input type="text" class="inputs" name="password" size="30"></td>
					</tr>
					<tr>
						<td><button type="submit" style="cursor: pointer" class="loginBtn">Login</button>
						<a class="frgtPass" href=" " style="font-size:12px">Forgot password?</a></td>
					</tr>
					<tr>
						<td><br><p class="frmt" style="font-size:16px">Student ID format:</p></td>
					</tr>
					<tr>
						<td><p class="frmtnum" style="font-size:16px">101-2016-0000</p></td>
					</tr>
				</table>
			</div>
		</div>
	</div>

	<div class="footer">
		<div class="copyright">
			<table class="txts" cellpadding="4">
				<tr>
					<td>Insight &#169; 2016</td>
				</tr>
			</table>
		</div>
		<table cellpadding="4">
			<tr>
				<td><a href=" " style="color: #E0E0E0">About</a></td>
				<td><font color="#E0E0E0">&bull;</font></td>
				<td><a href=" " style="color: #E0E0E0">Privacy</a></td>
				<td><font color="#E0E0E0">&bull;</font></td>
				<td><a href=" " style="color: #E0E0E0">Terms</a></td>
				<td><font color="#E0E0E0">&bull;</font></td>
				<td><a href=" " style="color: #E0E0E0">Help</a></td>
				<td><font color="#E0E0E0">&bull;</font></td>
				<td><a href=" " style="color: #E0E0E0">Feedback</a></td>
			</tr>
		</table>
	</div>
</div>

</body>

</html>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

  • 提示#1:不要使用表格。学习bootstrap,因为它更容易,并且如果正确实施将会响应。
  • 提示#2:除非确实需要,否则请尽量避免使用红色。这种颜色使人们认为存在错误并且很快就会吓跑用户。
  • 提示#3:确保登录和密码安全,因为这些可以非常快速,轻松地被黑客攻击。
  • 提示#4:使用互相恭维的颜色。

关于您的问题,您可以设置图片的CSS属性

-webkit-user-drag: none;
-moz-user-select: none;
user-drag: none; 
user-select: none;
-webkit-user-select: none;
-ms-user-select: none;