页面宽度大于视口,空白区域向右

时间:2017-06-22 19:06:23

标签: javascript jquery html css

我的页面宽度太长了。我不知道是什么让它变得不对称。它可能是我所放置的许多位置:相对的,以便使事物变得美丽和对齐,因为我不是任何其他方式的编码。

以下是对我的看法:

Print1 Print2

以下是我的代码:



<script src="jQueryUI/external/jquery/jquery.js"></script>
<script src="jQueryUI/jquery-ui.js"></script>
<script src="jQueryUI/jquery-ui.css"></script>

<script>
$(function() {
	$( ".draggable" ).draggable({
		axis: 'x', containment: [-234,0,450,0]
	});
});
</script>

<script>
$( "*", document.body ).click(function( event ) {
  var offset = $( "#circle" ).offset();
  event.stopPropagation();
  var conta = (offset.left - 752)/3.42;
  var posFinal = Math.round( conta );
  $( "#luc" ).text( posFinal + "%" );
});
  </script>
&#13;
.draggable {
	width: 700px;
	height: 0px;
	margin: 0px auto;
	position: relative;
}

#bar {
	width: 350px;
	height: 12px;
	background-color: #ff0a00;
	border-right: 350px solid #00b4ff;
	margin: 0px auto;
	border-radius: 5px;
}

#circle {
	position: relative;
	top: -15px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: black;
	margin: 0px auto;
}

#discordo {
	position: relative;
	top: 65px;
	left: -386px;
	font-weight: bold;
}

#concordo {
	position: relative;
	top: 31.8px;
	left: 390px;
	font-weight: bold;
}

#organizado {
	position: relative;
	top: -70px;
}
&#13;
<form method="post" action="x.php" id="questions">
<h3>Pergunta 1</h3>
<p>Maconha deveria ser legalizada para uso recreacional</p>
<div id="organizado">
<p id="discordo">Discordo</p>
<p id="concordo">Concordo</p>
<div id="bar"> </div>
<div class="draggable ui-widget-content">
<div id="circle"> </div>
</div>
<div>
</div>
<p id="luc"></p>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

没有足够的html和css代码来确定导致这种情况的原因,但是尝试通过将以下内容放入css文件中来将overflow-x:hidden添加到整个文档中:

html, body {
    overflow-x:hidden;
}

overflow属性指定内容溢出元素框时会发生什么。将其设置为隐藏将剪切所有多余的空间并使其不可见。 overflow-x会阻止您进行水平滚动