2

I want to select a div whose class = "c" & id = "i" :

 .c
 {
   color: red;
   border:1px;
   font-size:25px;
   background-color: yellow;
   width:200px;
 }

 <div id="i" class="c">change</div>

now how can i change only the width from class="c" properties for this div?

1
  • do you need answer only using css or using jquery also no problem Commented May 29, 2012 at 7:21

3 Answers 3

3

You can do something like this:

.c#i { width:400px }

This changes the width of the div with class c AND id i

Sign up to request clarification or add additional context in comments.

Comments

1

now how can i change only the width from class="c" properties for this div?

To select a div with class c:

div.c {width: yourValue;}

To change a div with class c AND id i:

.c#i {width: yourValue;}

Comments

1

Hey you can do this

#i.c{
width:xxx; //your value
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.