Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/91.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
我想用html在div中设置输入样式_Html_Css - Fatal编程技术网

我想用html在div中设置输入样式

我想用html在div中设置输入样式,html,css,Html,Css,编辑:我只能访问id为的div的html 我想做一些类似的事情,但我不能访问css文件,因为我的公司设置。我需要这样做从HTML没有css <html> <head> <style> #fileView_ctl01_D_STRT input { background-color: yellow; } </style> </head> <body> <div id = "fileView_ctl01_D_S

编辑:我只能访问id为的div的html

我想做一些类似的事情,但我不能访问css文件,因为我的公司设置。我需要这样做从HTML没有css

<html>
<head>
<style>
#fileView_ctl01_D_STRT input {
  background-color: yellow;
}



</style>
</head>
<body>


<div id = "fileView_ctl01_D_STRT" class="intro">
<div>
<div>
  <input>
  </div>
  </div>
</div>

</body>
</html>
我需要这样做从HTML没有css

<html>
<head>
<style>
#fileView_ctl01_D_STRT input {
  background-color: yellow;
}



</style>
</head>
<body>


<div id = "fileView_ctl01_D_STRT" class="intro">
<div>
<div>
  <input>
  </div>
  </div>
</div>

</body>
</html>
我假设由于某种原因,您不能在html中使用样式块,例如在某些电子邮件上下文中

您可以通过使用内联样式=背景色:黄色来克服这一问题


有几种不同的方法可以处理这个问题,但这取决于你说你不能使用CSS的意思。HTML几乎总是使用CSS来设计样式。但是您可以通过几种不同的方式添加CSS

内联风格:这是我猜想您可能需要的。在div中放置样式属性,并为其提供适当的方向。例子: 内部样式表:如上所示,可以嵌入内部样式表。 Javascript:最后,您可以使用Javascript控制样式。您必须获取要设置样式的元素,例如,使用指定的id,并对其应用样式。正如查特诺所证明的那样: 让输入=document.querySelectorfileView\u ctl01\u D\u STRT输入; input.style.backgroundColor=黄色;

该代码可以位于单独的外部文件中,您可以通过src属性在HTML中调用该文件


没有CSS,您几乎只能使用以下内容:

由于我的公司设置,我无法访问css文件。-那我们该怎么帮忙呢?你希望我们做什么?如果你没有访问CSS的权限,你就不太可能访问HTML。这段代码有效,你的问题到底是什么?给你的输入一个名称或classI我想你可以使用bootstrapCDN并使用其中的类,但我真的不知道你想实现什么。Good LuckI可以为id为的div元素添加样式。我无法访问其他PartsHanks,但我只能编辑id为的div的html,所以这对我没有帮助
    <style>
         #fileView_ctl01_D_STRT input {
         background-color: yellow;
    }
    </style>