Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Am I doing something wrong? Image tag inside a div, and applying image styles via div
Old 01-15-2010, 12:08 PM Am I doing something wrong? Image tag inside a div, and applying image styles via div
Extreme Talker

Posts: 177
Trades: 0
Simple example of my nestiness.
HTML Code:
<div class="container">
<img src="src">
</div>
Now in my css file I have...

Code:
.container
{
 some styles
}
Where the problem arises is following this style I have...

Code:
.container#img
{
max-width:150px;
}
Shouldn't that apply those styles to any image tags inside the container div? Or am I doing this wrong.

Thank you for any help.
kbfirebreather is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-15-2010, 12:12 PM Re: Am I doing something wrong? Image tag inside a div, and applying image styles via
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
#img would refer to an element with the ID of img

The correct syntax is

.classname element {
rules
}
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-15-2010, 12:13 PM Re: Am I doing something wrong? Image tag inside a div, and applying image styles via
Extreme Talker

Posts: 177
Trades: 0
Nevermind, I was having a brain fart.

The '#' is for ID tags.

So for anyone that was wondering, the correct way to do this is as follows:

Code:
.container
{
 some styles
}

.container img
{
max-width:150px;
}
The space was crucial.

EDIT: hah, thanks chris, I was actually typing that up during your reply :-x
kbfirebreather is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Am I doing something wrong? Image tag inside a div, and applying image styles via div
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.57947 seconds with 12 queries