Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 宽度设置为百分比时的HTML缩放div P>我需要有一个 ,当用户第一次打开网站时,我试着设置宽度为百分,并在代码代码>标签内放置 ,但是在这两种情况下,缩放都不能正常工作。如何将放在屏幕中央而不出现缩放问题_Css_Html_Width_Scaling - Fatal编程技术网

Css 宽度设置为百分比时的HTML缩放div P>我需要有一个 ,当用户第一次打开网站时,我试着设置宽度为百分,并在代码代码>标签内放置 ,但是在这两种情况下,缩放都不能正常工作。如何将放在屏幕中央而不出现缩放问题

Css 宽度设置为百分比时的HTML缩放div P>我需要有一个 ,当用户第一次打开网站时,我试着设置宽度为百分,并在代码代码>标签内放置 ,但是在这两种情况下,缩放都不能正常工作。如何将放在屏幕中央而不出现缩放问题,css,html,width,scaling,Css,Html,Width,Scaling,我所说的“缩放不起作用”是指当我放大太多时,它会停止增加宽度,同时仍然增加高度和内容,因此它会添加换行符,所有内容看起来都完全错误 谢谢你的回复,但是你的建议都有我描述过的问题。到目前为止,唯一的解决办法是将位置设置为绝对位置,并以厘米为单位手动设置“顶部”、“左侧”、“宽度”和“高度”参数。看看代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DT

我所说的“缩放不起作用”是指当我放大太多时,它会停止增加宽度,同时仍然增加高度和内容,因此它会添加换行符,所有内容看起来都完全错误

谢谢你的回复,但是你的建议都有我描述过的问题。到目前为止,唯一的解决办法是将位置设置为绝对位置,并以厘米为单位手动设置“顶部”、“左侧”、“宽度”和“高度”参数。看看代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="../../../All Files/HTML/Project/special.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class='centering'>
      <div class='content'>
test test test test test test test test test test test test test test
      </div>
</div>
</body>
</html>

我非常感谢你花时间帮助我

例如,如果您的div是:

<div id="content">
  //div content
 </div>
只需根据需要更改宽度。

您有:

<center>
    <div>
    </div>
</center>
你可以这样用

.wrapper{
      width:50%;
      margin:0 auto;
}

.content{
      float:left;
}

<div class='wrapper'>
      <div class='content'>
           //your content
      </div>
</div>
.wrapper{
宽度:50%;
保证金:0自动;
}
.内容{
浮动:左;
}
//你的内容

或者,对于内容选择器,您也可以将文本对齐属性指定为“左”。

什么是“缩放不起作用”。你应该尝试更详细地描述你正在寻找的行为。最好的方法是提供您现在拥有的代码,并指出哪些部分不起作用,而不仅仅是以div为中心。它还集中了div的内容。
<center>
    <div>
    </div>
</center>
<div class="centering">
    <div class="content">
        Text here!
    </div>
</div>
.centering {
    text-align: center;
}
.content {
    text-align: left;
    margin: 0 auto;
    width:50%;
}
.wrapper{
      width:50%;
      margin:0 auto;
}

.content{
      float:left;
}

<div class='wrapper'>
      <div class='content'>
           //your content
      </div>
</div>