Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do have a single class name with a space in it using CSS [duplicate]

Tags:

css

I have HTML like this:

<div class = "address full">

I want to add css. How do I write a selector for a class with a space in it? This is not doing waht I want.

."address info" {
  background: #eee;
}
like image 523
bernie2436 Avatar asked Jan 17 '26 21:01

bernie2436


1 Answers

You can't - there is no way of having a space within a single classname. So the element you've provided there doesn't have a 'class name with a space in it'. The element has two different classes address and full. You can of course target this element by specifying both classes like this:

.address.full{}

If you really want 'spaces' in your class name, you'll need another way of clarifying what you see as a space, such as hyphenation:

<div class = "address-full">

Or maybe camel-case

<div class = "addressFull">
like image 129
George Avatar answered Jan 19 '26 20:01

George