Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/453.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
Javascript 将每个组件的根包装设置为全身高度_Javascript_Css_Components_Styled Components - Fatal编程技术网

Javascript 将每个组件的根包装设置为全身高度

Javascript 将每个组件的根包装设置为全身高度,javascript,css,components,styled-components,Javascript,Css,Components,Styled Components,我正在做一个React项目来创建一个简单的网站。我有10到15个组件,它们都有不同的css样式表。现在我想要的是,无论用户登录到哪个组件,我都希望index.html的根包装保持为100vh。但我似乎不知道应该在哪个样式表上为root添加样式。如果你有任何想法,请分享 先谢谢你。继续做好工作与React项目中的index.html文件类似,可能有一个App.css文件,您可以在其中将根目录设置为100vh,即正文或html最小高度。在App.css中,您可以包括 html, body{min-h

我正在做一个React项目来创建一个简单的网站。我有10到15个组件,它们都有不同的css样式表。现在我想要的是,无论用户登录到哪个组件,我都希望index.html的根包装保持为100vh。但我似乎不知道应该在哪个样式表上为root添加样式。如果你有任何想法,请分享


先谢谢你。继续做好工作

与React项目中的index.html文件类似,可能有一个App.css文件,您可以在其中将根目录设置为100vh,即
正文
html
最小高度。在App.css中,您可以包括

html, body{min-height: 100vh;}

如果我直接在index.html本身上添加样式标记,可以吗?是的,添加style=“min height:100vh;”也可以,但前提是您准备在您的网站@HimanshuTariyal的所有模块和组件中普遍接受此样式,但尝试给它太多的主体标记