Find html element in css

3

I need to find a specific element of what's in my code in html only in css, exemplifying:

What to do type:

meuElemento [type=input]{
    color: #FFFFFF;
}

I'm not sure what to do, but I do not know how to do it.

How can I do this? I already looked for several internet sites and I could not.

    
asked by anonymous 09.05.2018 / 15:08

2 answers

4

Using% css% would look like this: (note the construction of attr [id="textUm"] )

[id="textoUm"] {
 border: 2px solid red;
}

input { 
 border: 2px solid black;
}
<input type="text" id="textoUm" value="com ID">
<input type="text" value="sem id">
But if you are going to put the css using the ID you do not have to use attr create direct the class attr[]

When you put the style in the ID you have to get the name by #textoUm {seu css} and when you create a style to by in the class #textoUm {}

Mozilla documentation link on ctr attr link is in PT and will help you worth reading

    
09.05.2018 / 15:21
3

When you want to use with id or class is simpler

Example with id:

#textoUm{
    color: #FFFFFF;
}

Example with class:

.textoUm{
    color: #FFFFFF;
}

Or if you want something like, an input with class 'textUm' for example, you can do this:

input.textoUm{
    color: #FFFFFF;
}

Or with some id:

input#textoUm{
    color: #FFFFFF;
}

A small example:

.texto{
  color: #f00;
}
#texto{
  color: #00f;
}
input.texto{
  color: #0f0;
}
input#texto{
  color: #ff0;
}
<input type="text" value="teste" class="texto" />
<input type="text" value="teste" id="texto" />
<div class="texto">teste</div>
<div id="texto">teste</div>
    
09.05.2018 / 15:13