republican-creole
Search:  

 
 
   All ForumsHot TopicsGallery






how-to block ads


 
Forums » Tech and Talk » OS and Software » Webmasters and Developers » CSS and divs - apply to all div contents?
Search Topic:
Uniqs:
342
Share Topic:
RSS topic:
toggle:
flat / full
normal / watch
Posting:
Post a:
Post a:
javascript onclick »
« Help to resize an array in C.  
AuthorAll Replies


sporkme
drop the crantini and move it, sister
Premium,MVM
join:2000-07-01
Morristown, NJ
·Optimum Online

CSS and divs - apply to all div contents?

I've been looking at a ton of CSS tutorials, and I'm not finding what I'm looking for.

I've got a number of small divs where I need to style everything the same. In short, this should present me with a tiny box with a border on top, or so I thought...


That does not seem to do much to my divs with the class "menuleftStore". But if I apply the same parameters to a more specific element (ie: ".menuleftStore a"), all the stuff wrapped in that element does get styled.

I'm obviously missing something about how styles get applied to div contents... What do I do to make the styles for that div apply to all the contents of the div?

--
with every mistake we must surely be learning


usa2k
Please PRAY for Rebekah
Premium,MVM
join:2003-01-26
Canton, MI
clubs:

1 edit
CSS applies each change in order.
Perhaps this is not far enough down the list?

Typo on line 12? "width:147x;"


sporkme
drop the crantini and move it, sister
Premium,MVM
join:2000-07-01
Morristown, NJ
·Optimum Online

Yeah, that's a typo, fixed it...

This is at the very bottom of my included CSS file.

I'm just confused - I know I really want everything in the div to inherit the div properties (unless I override it), but I'm not sure if that's how the rules actually work. I'm also lost as to what element just a line of text in that div would be. For example, I know that if I added a ".menuleftStore p" to the css file, I'd be able to style everything in a paragraph in that div. Or ".menuleftStore a", etc. But I don't know how to refer to text that's in no other tag than the div itself...
--
with every mistake we must surely be learning


usa2k
Please PRAY for Rebekah
Premium,MVM
join:2003-01-26
Canton, MI
clubs:
·VOIPo
·WOW Internet and C..
·Broadvox Direct

OK, it looks like font is not part of a DIV tag
»www.w3schools.com/tags/tag_DIV.asp

Been so long since I hand coded CSS I think I need to re-read my CSS Mastery text

Of course the more specific the example, like a demo page, the better people her can help.
--

Jim, VoIP 12/2002, VOIPo 2/2007
FAH-Tool ... Pets ... Join Artist-247


sporkme
drop the crantini and move it, sister
Premium,MVM
join:2000-07-01
Morristown, NJ
·Optimum Online

Quick fix - tables!

The site is already a mish-mash of both after a conversion to a CMS. I was just hoping to nail down the div stuff, which I think I have. Some kind of nutty inheritance that's too complicated to track down is likely what's screwing me up.

It looks like the following is also a valid selector: "div.foo *"

Doesn't work though.
--
with every mistake we must surely be learning


twizlar
I dont think so.
Premium
join:2003-12-24
Brantford, ON
reply to sporkme
Need a link to fix anything.


theedj
Right Back At-Cha
Premium
join:2002-12-12
Calgary
clubs:

reply to sporkme
The way CSS cascades may be your issue. If you have an id attribute on the div that has a border: none with it then it will override the class. So not only does CSS cascade from external style sheet load (first to last) -> body -> element but in my experience it also cascades from class -> id -> inline. Of course you can always 'override' this with the !important tag. Check all that out...or like twizlar See Profile & usa2k See Profile mentioned, a link (or complete source) would help out easier.
--
# a b c d e f g h i j k l m n o p q r s t u v w x y


marigolds
Gainfully employed, finally
Premium,MVM
join:2002-05-13
Saint Louis, MO

reply to sporkme
Easiest way to fix this is to load up your page in firefox with firebug and inspect the divs. They will show you which styles are being overridden and let you manipulate the styles to see what happens when you turn off specific overriding styles (so that way if you have several different precedent styles, you can diagnose them one at a time).


Jon
Premium
join:2001-01-20
Lisle, IL

reply to sporkme
Not too sure if the order matters since I'm not that great with css but...

Shouldn't this

Be like this..


Mike D
I want your skulls
Premium
join:2001-09-12
Harrisburg, PA
clubs:
·Comcast

said by Jon See Profile :

Not too sure if the order matters since I'm not that great with css but...

Shouldn't this

Be like this..
I don't believe the order of the line type and line size selectors matters.

--
In a society that is drug infested, violence wracked, and polluted by chemical greed, no one has ever died from an overdose of pornography!

______________________________


KoolMoe
Aw Man
Premium
join:2001-02-14
Annapolis, MD
clubs:
·Verizon FIOS
·Speakeasy


1 edit
reply to sporkme
I think the order does matter as I think I've had problems when I mistakenly do the incorrect order....but I could be thinking of something else (like padding order matters, related to which border gets what value).

Spork, how are you applying the classes in your div's? Starting with the period, you're defining a class, so you have to declare 'class=' in your div, not 'id='.
But you may already have that.

If you want to stylize text within a div that's not in a predefined tag (i.e. H1, strong, etc) you can use to rather painlessly apply a style.
KM

edit: it doesn't appear the order matters! Good to have checked, thanks for the conversation

Your style works fine for me here with the width error fixed (px).


sporkme
drop the crantini and move it, sister
Premium,MVM
join:2000-07-01
Morristown, NJ
·Optimum Online

KM, I think I was applying the class correctly (I read that a div should only use the "id" tag if it's the sole div with that id - I had multiple divs I wanted in the same class, so I used the "class" tag), but at this point I just have to assume that something else on the page was overriding it.

The page has a mixed layout - some portions are split up using divs, lots of it split up using tables.

One day the thing could use a total re-working, but I'm not even sure how long these people will be sticking with the current design, so I didn't want to get too involved. Using a table for this extra menu ended up looking fine, so everyone's happy for the time being...

Thanks all!
--
with every mistake we must surely be learning


usa2k
Please PRAY for Rebekah
Premium,MVM
join:2003-01-26
Canton, MI
clubs:
All IDs must be unique, so class is used to style multiple areas of text. You were correct in that approach.
-
Forums » Tech and Talk » OS and Software » Webmasters and Developersjavascript onclick »
« Help to resize an array in C.  


Tuesday, 15-Dec 00:01:47 Terms of Use | Privacy Policy | Hosting by www.nac.net - DSL,Hosting & Co-lo | feedback | contact
over 10 years online! © 1999-2009 dslreports.com.
page compression OFF
Most commented news this week
· [135] Verizon Kindly Forgives Kid's $21,917 3G Bandwidth Bill
· [103] Google To Sell Phone Directly To Consumers
· [71] TiVO Tries To Figure Out Where It Fits
· [53] Faster Verizon DSL Service Will Burn Your House Down
· [45] NY Times: AT&T 3G Network Is Secretly Awesome
· [27] Rural Broadband User? You're Screwed
· [26] Can Satire Take Down AT&T's 3G Network?
· [23] Sweden First To Get LTE Service
· [5] Monday Evening Links
· [1] Monday Morning Links
Most people now reading
· Ashen Verdict Rep farming guide (ICC 10) [World of Warcraft]
· Official Mediacom Email Discussion Thread [Mediacom]
· Lady Deathwhisper Strategy - 3.3 Live [World of Warcraft]
· [Rant] BUG in MY FOOD, After i ate 90% of it.. [Rants, Raves, and Praise]
· personal check etiquette [General Questions]
· how to get money back when ripped off [General Questions]
· IMG 1.7 (IMG Updates and Discussion) [Verizon FIOS TV]
· ICC10 [World of Warcraft]
· What VOIP changes did you make in 2009? [VOIP Tech Chat]
· Windows 7 boot manager editing questions [Microsoft Help]