User Name
Password
AppleNova Forums » Genius Bar »

CSS question.


Register Members List Calendar Search FAQ Posting Guidelines
CSS question.
Page 1 of 2 [1] 2  Next Thread Tools
Wickers
is not a kind of basket
 
Join Date: May 2004
 
2005-01-02, 21:10

Well like most of my projects... I have left my website in the closet for a few months.

Today I pulled it out and dusted it off.... it looks nice but I was starting to feel the limit of standard tables in HTML.

So I moved on to CSS!

This is my first attempt so be nice... I have a lot to learn but it seems easy to pick up.

Getting to the point, I have moved some of my HTML over to my new CSS based page... and ditched the rest. What I want to do is create a simple menu that has each item change it's background colour when rolled over by the mouse.

Kinda like how this nav. menu does it: http://www.mozilla.org/support/

I wgetted the css files from that site... but I can't seem to find the area that takes care of it's side menu.

So far my section for my menu on my CSS page looks like this:
Code:
ul.navbar { list-style-type: none; padding: 0; margin: 0; position: absolute; top: 2em; left: 1em; width: 9em } ul.navbar li { background: lightgrey; margin: 0em 0; padding: 0.3em; border-right: 1em solid black } ul.navbar a { text-decoration: none } a:link { color: blue } a:visited { color: purple }
So what would be my next step?

no sig, how's that for being a rebel!
  quote
Wickers
is not a kind of basket
 
Join Date: May 2004
 
2005-01-02, 21:13

Oh, I am also trying to get the menu to fallow along as you scroll down.
  quote
Wickers
is not a kind of basket
 
Join Date: May 2004
 
2005-01-02, 21:24

by adding.
Code:
a:hover { background: cyan }
I can get the links in the menu co do what I want... but it does not effect the whole area around the menu section, just around the text. Once again, I want it to look like that link in my first post.

no sig, how's that for being a rebel!

Last edited by Wickers : 2005-01-02 at 21:30.
  quote
staph
Microbial member
 
Join Date: May 2004
Send a message via AIM to staph  
2005-01-02, 21:33

Is something like this what you're after?

Try setting the hover attribute for a div that the link is in.

Btw, with my limited CSS knowledge, I think this is what Mozilla are using:

Code:
#nav li a { display: block; padding: 8px 10px; text-decoration: none; background: #EDF2F2; border-bottom: 1px solid #ddd; border-top: 1px solid #fff; border-right: 1px solid #ddd; } #nav li a:hover { background: #E0E9E9; } #nav li li span { /* used for un-linked menu items */ padding: 4px 8px 4px 20px; } #nav li li a { padding: 6px 8px 6px 20px; }

Last edited by staph : 2005-01-02 at 21:39.
  quote
Wickers
is not a kind of basket
 
Join Date: May 2004
 
2005-01-02, 21:52

Yes, that's kinda how I want it to look... thanks for the example.

But one thing... now I'm a bit set off by the use of '#'. (remember I just started learning CSS a few hours ago.)

Are there any good reference pages you know of?

no sig, how's that for being a rebel!
  quote
johnq
Multi-touch Piñata
 
Join Date: May 2004
 
2005-01-02, 22:02

I suggest we make this thread's title "CSS questions" so that it can be the AN CSS thread for any questions.

Additionally, we could make it a sticky and title it "CSS questions for Brad".

"Peace cannot be kept by force. It can only be achieved by understanding." - Albert Einstein
  quote
staph
Microbial member
 
Join Date: May 2004
Send a message via AIM to staph  
2005-01-02, 22:03

Quote:
Originally Posted by \/\/ickes
Yes, that's kinda how I want it to look... thanks for the example.

But one thing... now I'm a bit set off by the use of '#'. (remember I just started learning CSS a few hours ago.)

Are there any good reference pages you know of?
If you're willing to lay out cash (or subscribe to safari), Eric Meyer has written a really excellent book on the subject.
  quote
johnq
Multi-touch Piñata
 
Join Date: May 2004
 
2005-01-02, 22:09

Short answer: Use "#" (ID) for when it is a container that will be unique on the page. A section that there will only ever be one of.

Use "." (class) for things that there will be (potentially) multiples of.

"Peace cannot be kept by force. It can only be achieved by understanding." - Albert Einstein
  quote
Wickers
is not a kind of basket
 
Join Date: May 2004
 
2005-01-02, 22:20

cool... thanks...

Now my style sheet looks like this. . .
Code:
body { padding-left: 11em; color: black; background-color: white; } h1 { font-family: sans } ul.navbar { list-style-type: none; padding: 0; margin: 0; position: absolute; top: 2em; left: 1em; width: 9em; } ul.navbar li { background: lightgrey; margin: 0em 0; padding: 0.3em; border-right: 1em solid black } ul.navbar li a:hover { background: grey; padding: 0.3em; } ul.navbar a { text-decoration: none } a:link { color: blue } a:visited { color: purple }
I am not using the '#' way because this menu will be common across each page.

Now, the hover looks good... but it's still not exactly the way I'd expect it to be. It changes more then just around the text... (0.3em padding that is) but it needs to 'high-light' the entire section around the text link. (once again, ref: that mozilla link)

Thank you for your help.

no sig, how's that for being a rebel!
  quote
ast3r3x
25 chars of wasted space.
 
Join Date: May 2004
Send a message via AIM to ast3r3x  
2005-01-02, 23:14

Well then while I have your attention....

I'm trying to use a transparent backdrop...so cleverly called backdrop, but when I put text in/over it, it starts at the transparency of the box it's in. So even setting it to 100% is only 100%*x% (where x is the backdrop %)...yay math!

But seriously, it might make sense if you look at it... http://mobocracy.no-ip.com

Yes it's kinda ugly, yes I stole the background from acquisition, but if you know that you are probably stealing music

I know I could just do text on top of it, but I'd prefer not to have to use positioning just because it's cleaner that way.
  quote
drewprops
Space Pirate
 
Join Date: May 2004
Location: Atlanta
 
2005-01-03, 00:40

I know that Eric Meyer made a GIF image that was a checkerboard (half of the squares making the checkerboard were transparent), so it worked out as a transparent background image, onto which he included "normally" marked-up text. It's a mechanical fix, but Big Dumb Rockets seem to work. Would this fix your problem??

Steve Jobs ate my cat's watermelon.
Captain Drew on Twitter
  quote
johnq
Multi-touch Piñata
 
Join Date: May 2004
 
2005-01-03, 00:44

Checkerboard vs. PNG:

http://www.nullface.com/ai/itunesBG/itunes.html

(PNG transparency of course doesn't work in WinIE)

The thing is, the GIF strobes when scrolled on LCDs.

"Peace cannot be kept by force. It can only be achieved by understanding." - Albert Einstein
  quote
Moogs
Hates the Infotainment
 
Join Date: May 2004
Location: NSA Archives
 
2005-01-03, 01:29

Cool thread. I've been reading up on CSS myself and am about to start building a new self-promotional site (in lieu of sending resumes everywhere) that will be entirely based on it. Good to know there's a place on this board where I might get some useful answers before searching elsewhere on the web.

The best learning site I've found is the CSS Zen garden ( the mondo-menu version where you can see all the submissions and check their sample pages ), though there are many good ones out there.

Two great books:
For the Box Model theory and reference:
Cascading Style Sheets, The Definitive Guide (2e) by Eric Meyer

...and for a mixture of Box Model theory and practical applications:
Cascading Style Sheets - Separating Content from Presentation (2e) - Briggs, Champeon, Costello, & Patterson

...into the light of a dark black night.
  quote
johnq
Multi-touch Piñata
 
Join Date: May 2004
 
2005-01-03, 01:42

If you hate the checkerboard trick because it is non-programmatic, you know you could use PHP to have GD make a checkerboard gif of any color and save it (even if only run once/seldom, which is ideal!), so it would be 100% programmatic.

"Peace cannot be kept by force. It can only be achieved by understanding." - Albert Einstein
  quote
drewprops
Space Pirate
 
Join Date: May 2004
Location: Atlanta
 
2005-01-03, 02:53

Ooooo, I personally LIKE the checkerboard version because it looks like Print. I have as yet to make GD work on the Earthlink server, but the last time I tried I wasn't as far along with PHP and CGI as I am now. That's some SERIOUS geekout to go with GD, but it is tres cool and I suppose it's faster too?

The book Moogs refers to is the same one where I learned the checkerboard trick, Eric Meyer wrote the first breakout, must-have book on CSS but I have to say that it was (and still is) really hard to to follow at times if you're a true CSS n00b. The entire concept makes your brain hurt.

Perhaps my kerchief was tied too tight?

Steve Jobs ate my cat's watermelon.
Captain Drew on Twitter
  quote
Brad
Selfish Heathen
 
Join Date: May 2004
Location: Zone of Pain
 
2005-01-03, 03:00

I'd think the concepts would only be hard if you haven' done any programming before. For folks who have worked with object oriented languages and know the importance of separating presentation from content, CSS should come pretty easily.

Of course, I'm not expecting everyone has done OO programming. I'm just saying... eh... maybe it's just me. Never mind!

*crawls into bed*

The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting.
  quote
johnq
Multi-touch Piñata
 
Join Date: May 2004
 
2005-01-03, 03:07

There's ways to have GD just make an image once and never again. Just check for the file's existence. I wouldn't want GD running each time a user comes to a page

Also you could play with non-checkerboard patterns.

And you could even use checkerboard pattern for PNG, so you'd get a blocky effect and see through at the same time. I mean both squares could have opacities less than 100. Wouldn't let WIN IE users see through but who cares (Kidding). (Kinda).

Final note: Don't make checkerboards be too small. I mean do one fairly large like 100x100 or somesuch. Were one tempted to make a 2x2 checkerboard thinking it'll save memory, think again.

The effort the browser will need to expend duplicating/tiling the 2x2 image will consume far more memory/take more time than you would think. Better to downloading a moderately larger image that needs to tile less times.

"Peace cannot be kept by force. It can only be achieved by understanding." - Albert Einstein

Last edited by johnq : 2005-01-03 at 03:15.
  quote
ast3r3x
25 chars of wasted space.
 
Join Date: May 2004
Send a message via AIM to ast3r3x  
2005-01-03, 08:31

So I'm f'd is what you guys are saying?

I either use the checkerboard pattern and have my site look like shit, use png's and have it look good, but to the 3% of people who view it, or use GD to create a ridiculously large image? MMMmmmm got to loooove WinIE!

Ugliest f'n thing I've ever seen...here

Last edited by ast3r3x : 2005-01-03 at 08:37.
  quote
drewprops
Space Pirate
 
Join Date: May 2004
Location: Atlanta
 
2005-01-03, 10:07

Just like with dot pitch in type you might want to play with the SIZE of your checks. Don't you hate answers like these?
  quote
ast3r3x
25 chars of wasted space.
 
Join Date: May 2004
Send a message via AIM to ast3r3x  
2005-01-03, 10:14

So I'll detect the browser, and if it's winIE, I'll just have FireFox start downloading

Then I'll make 500 popups saying if they were using firefox this probably couldn't happen...of course this will distract them while it finishes downloading.
  quote
Wickers
is not a kind of basket
 
Join Date: May 2004
 
2005-01-03, 16:36

That sounds nasty...

anyway,

Now there is one thing that is pissing me off here... for some reason when the menu is rendered it adds a one pixle thick line between one or two of the menu items... not all of them, and where the line is rendered depends on some of the spacing. So my question is, if I have all the spacing in the world set to 0 and padding just on the text itself.. and the odd line shows (not between all items just between two or three depending on how many menu items I have) how do I kill it? Could it be a browser problem? I've seen a bunch of CSS demos... some really cool, and none have problems rendering with Firefox so I don't think it's the browser.. .

Anyway... off for some food.

Thanks again.

BTW, it looks like this:

See the white line between the last two menu items? The code is the same fore each item so I'm a bit perplexed. (ALSO, this is just a test page I made... just fucking around... not my current site, which looks like crap for now)

no sig, how's that for being a rebel!
  quote
drewprops
Space Pirate
 
Join Date: May 2004
Location: Atlanta
 
2005-01-03, 22:18

You need to give us the page/code so we can look.
The fact that it's near the end of a list makes me think that it might be associated with the way that you're "capping off" the list with the "fourms" (sic) link. It might be that you have an upper/lower margin/pad that begins to show itself at the very end case.

So, pagecode might help. But for now, I'm heading to bed 'cause I had a late work night last night and am whooped. But, I did solve four more thingies with my own sitework... some PHP, some CSS, all annoying.

Steve Jobs ate my cat's watermelon.
Captain Drew on Twitter
  quote
Wickers
is not a kind of basket
 
Join Date: May 2004
 
2005-01-03, 23:59

Code:
body { padding-left: 11em; color: black; background-color: white; } h1 { font-family: sans } ul.navbar { list-style-type: none; padding: 0; margin: 0; position: absolute; top: 2em; left: 1em; width: 9em; } ul.navbar li { background: lightgrey; margin: 0; padding: 0.3em 0; border-right: 0.8em solid black; border-top: 0.1em solid black; } ul.navbar li a:hover { background: grey; padding: 0.3em 0; } ul.navbar a { text-decoration: none } a:link { color: blue } a:visited { color: purple }
And this is the test page's menu area...
Code:
...(skip a few lines)... <link rel="stylesheet" href="style.css"> ...(skip a few lines)... <ul class="navbar"> <li><a href="index.html">Project Home</a> <li><a href="musings.html">Download</a> <li><a href="town.html">Screenshots</a> <li><a href="links.html">Links</a> <li><a href="forums.html">fourms</a> </ul> ...(skip the rest)...
  quote
johnq
Multi-touch Piñata
 
Join Date: May 2004
 
2005-01-04, 00:18

I see no space in Safari or IE. What browser?
  quote
Wickers
is not a kind of basket
 
Join Date: May 2004
 
2005-01-04, 00:21

Firefox/mozilla... sigh I was hoping it was not a rendering problem.
  quote
johnq
Multi-touch Piñata
 
Join Date: May 2004
 
2005-01-04, 01:06

It's that padding: 0.3em 0; shit. Can you live with 0.2em?

Better still, use pixel values? This is for screen not print?

Copy your list a handful of times so you see 20 or so items. See the white gap? Now change the text size in the browser, up or down. The gap will jump from 3, 5, 5 to 2, 2, 3, etc.

Clearly the non-pixel values are not rendering correctly. Make it all pixels and it's all good.

<someone insert smug know-it-all CSS guru retort proving me oh-so wrong here >

I know about using ems as workarounds for IE deficiencies
http://www.clagnut.com/blog/348/

...but I'd avoid 'em for layout.

"Peace cannot be kept by force. It can only be achieved by understanding." - Albert Einstein

Last edited by johnq : 2005-01-04 at 03:10.
  quote
Wickers
is not a kind of basket
 
Join Date: May 2004
 
2005-01-04, 02:13

Sweet!

That worked wonders... err... as I am still learning, what does 'em' stand for? What kind of unit is it? (I know I could just RTFM in this case... but hell while I'm at it)

Once again, thanks... now on to more CSS fun!

no sig, how's that for being a rebel!
  quote
johnq
Multi-touch Piñata
 
Join Date: May 2004
 
2005-01-04, 02:29

Well, it's a typography measurement, so I only use em for text.

There might be other valid non-text uses in CSS but usually pixels or percentages will be best.

There are arguments for em in DIVs etc (see the above clagnut link) blah blah

Quote:
Pixel sizing is illogical: it relies on current display technology.


Suppose a new type of display is launched next week which has half the dot pitch, allowing users to comfortably run 2048×1536 on a 15” display.

My em-based site (http://tranchant.plus.com/) will be fine – the user will set their default font size to something readable, and my site (except images) will appear the same as before, but taking advantage of the higher resolution display quality.

“Your” px-based site will be totally illegible unless the browser supports resizing – in which case it’s no longer using your suggested pixel sizes. So why use them in the first place?!
<-- Whatever. Enlighten me. I'm evil. I like pixels

Wikipedia is your friend:
http://en.wikipedia.org/wiki/Em_%28typography%29

"Peace cannot be kept by force. It can only be achieved by understanding." - Albert Einstein

Last edited by johnq : 2005-01-04 at 04:03.
  quote
staph
Microbial member
 
Join Date: May 2004
Send a message via AIM to staph  
2005-01-04, 03:59

An em is literally the width of a "m" character. Similarly, an m-dash (—) is a dash the width of an m, and an n-dash (–) is a dash the width of an n.
  quote
drewprops
Space Pirate
 
Join Date: May 2004
Location: Atlanta
 
2005-01-04, 07:28

Well yes, that makes perfect sense. (??) Not poking too much fun at Printers though, those guys are the ultimate twidgets. I think that we should come up with a new universal measurement unit that is based on the atomic decay rate of IE.

Steve Jobs ate my cat's watermelon.
Captain Drew on Twitter
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Page 1 of 2 [1] 2  Next

Post Reply

Forum Jump
Thread Tools
Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML question... Wickers Programmer's Nook 16 2019-07-29 22:46
Windows question: DVD ripping software torifile Third-Party Products 24 2005-04-29 16:16
Dumb PowerBook hard drive question... psmith2.0 Genius Bar 12 2004-11-16 10:54
video capture question Mac+ Genius Bar 11 2004-10-03 21:19
airport express, digital out question. piwozniak Apple Products 6 2004-07-15 09:59


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 21:11.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2024, AppleNova