-3

i'm tring to make something looks good

i was tring to use css but i got a problem

only a inline style is working...

reply new {
        display: inline-block;
        height: 5vh;
    }
    reply new writer {
        width: 20px;
    }
    reply new content {
        width: 20px;
    }
<input type="text" class="reply new writer form-control input-sm" style="width: 20px">
<input type="text" class="reply new content form-control input-sm">

it doesn't work.

but

<input type="text" class="reply new writer form-control input-sm" style="width: 20px">
<input type="text" class="reply new content form-control input-sm">

it works.

what should i do

Temani Afif
  • 245,468
  • 26
  • 309
  • 415
이연준
  • 41
  • 5

2 Answers2

2
reply new

This is a type selector, followed by a descendant combinator, followed by another type selector. It will match:

<reply><new></new></reply>

… which is not valid HTML.


To select an element based on a class you need to use a class selector, which starts with a ..

To select an element based on multiple features, you need to combine them directly without putting descendant combinators between them.

.reply.new {
    ...
}
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
1

You are missing a "." before you're class selectors.

When trying to target a "class" you need to use .ClassName W3Schools has examples and a good interactive example too.

Also if you want to target two classes it's:

.ClassOne.ClassTwo

That will target:

<div class="ClassOne ClassTwo">Hello</div>
Harrison
  • 1,654
  • 6
  • 11
  • 19