|
Whatever
|
 |
« on: January 14, 2012, 03:13:10 PM » |
|
This is what I would like to achieve with div's and css but can't get my head round it. Can anyone start me off please? Cheers. 
|
|
|
|
|
Logged
|
|
|
|
|
samhs
|
 |
« Reply #1 on: January 14, 2012, 03:45:46 PM » |
|
<div id="container"> <div id="logo"><img src="your logo" /></div> <div id="toplinks"><ul><li>link 1</li><li>link 2</li></ul></div> <div id="bannerad"><img src="banner ad" /></div> </div>
<style>
#container { width: 920px; }
#logo { width: 300px; height: 100px; margin-right: 20px; float: left; }
#toplinks { width: 600px; height: 30px; float: left; }
#bannerad { width: 600px; height: 70px; float: left; } </style>
|
|
|
|
|
Logged
|
Loose adj a not held together; not fastened or firmly fixed in place Lose verb to misplace something. To fail to keep or obtain something, especially because of a mistake, carelessness, etc. --- Blog: www.ohwrite.co.ukTwitter: www.twitter.com/samhs
|
|
|
|
samhs
|
 |
« Reply #2 on: January 14, 2012, 03:46:45 PM » |
|
And of course:
#toplinks ul { margin:0; padding: 0; }
#toplinks ul li { margin: 0; margin-right: 10px; padding: 0; list-style: none; float: left; }
|
|
|
|
|
Logged
|
Loose adj a not held together; not fastened or firmly fixed in place Lose verb to misplace something. To fail to keep or obtain something, especially because of a mistake, carelessness, etc. --- Blog: www.ohwrite.co.ukTwitter: www.twitter.com/samhs
|
|
|
|
Whatever
|
 |
« Reply #3 on: January 14, 2012, 05:13:13 PM » |
|
Thanks Sam,
Will try that. Thought there was more to it than that, it's the floats etc I don't get still.
Cheers,
Paul
|
|
|
|
|
Logged
|
|
|
|
|
Whatever
|
 |
« Reply #4 on: January 15, 2012, 11:20:39 PM » |
|
That worked thanks Sam. Just one more thing, I've tried and failed to align the list to the right hand side of the div. I've tried adding text-align: right; but no joy. If I put plain text the inside a paragraph tag that aligns to the right.
Any pointers on this please anyone?
Thanks.
|
|
|
|
|
Logged
|
|
|
|
suedenem
|
 |
« Reply #5 on: January 16, 2012, 09:47:23 AM » |
|
Try floating the list items to the right, instead of left.
|
|
|
|
|
Logged
|
So this SEO copywriter walks into a bar, grill, pub, public house, Irish bar, bartender, drinks, beer, wine, liquor...
Beware my weird, cross-dressing comment's; they are pretty standard examples of trolling.
|
|
|
|
Dom
|
 |
« Reply #6 on: January 16, 2012, 02:34:50 PM » |
|
Something I always do to try and reduce the number of slight differences between browsers (in terms of the layout) is to set the margins and paddings of everything to zero to start. * { margin: 0; padding: 0; } It basically resets all of the default paddings and margins for elements in all browsers, so you've got a blank canvas, as it were, to work with.
|
|
|
|
|
Logged
|
|
|
|
|
Whatever
|
 |
« Reply #7 on: January 16, 2012, 03:35:35 PM » |
|
Try floating the list items to the right, instead of left.
Tried this again and it works, but for some strange reason the last link jumps to the front of the list of links. Something I always do to try and reduce the number of slight differences between browsers (in terms of the layout) is to set the margins and paddings of everything to zero to start. * { margin: 0; padding: 0; } It basically resets all of the default paddings and margins for elements in all browsers, so you've got a blank canvas, as it were, to work with. Cheers. So does that mean after those I could add margin-right:5px; or similar, or am I getting the wrong end of the stick?
|
|
|
|
|
Logged
|
|
|
|
suedenem
|
 |
« Reply #8 on: January 16, 2012, 04:33:43 PM » |
|
If it's a simple menu of just text, try this: #toplinks ul { margin:0; padding: 0; [b]display: block;[/b] [b]text-align: right;[/b] }
#toplinks ul li { margin: 0; margin-right: 10px; padding: 0; list-style: none; [b]display: inline;[/b] }
Oh, and change your div names from "bannerad" to almost anything without 'banner' or 'ad'. It's the same as hiring Brian Blessed to yell "THIS IS AN ADVERT. BLOCK ME, AD BLOCKERS, BLOCK ME". Same with image names, too.
|
|
|
|
|
Logged
|
So this SEO copywriter walks into a bar, grill, pub, public house, Irish bar, bartender, drinks, beer, wine, liquor...
Beware my weird, cross-dressing comment's; they are pretty standard examples of trolling.
|
|
|
|
sarahA
|
 |
« Reply #9 on: January 16, 2012, 07:27:50 PM » |
|
Something I always do to try and reduce the number of slight differences between browsers (in terms of the layout) is to set the margins and paddings of everything to zero to start. * { margin: 0; padding: 0; } It basically resets all of the default paddings and margins for elements in all browsers, so you've got a blank canvas, as it were, to work with. That bugs the hell out of me when I get something (eg. a WP theme for one of my own sites) and find that's the case. Having to set the margins/padding for paragraphs, lists, headers etc. is surely far more work that just removing it for a specific element? I guess it's whatever suits but IMO you're making extra work by removing margin/padding off an element that you're going to want and have to add again. Also makes it harder to read unless you continually bear in mind that the margin/padding has been removed globally. Fine if you're the original developer, not necessarily so if you're working with someone else's code.
|
|
|
|
|
Logged
|
|
|
|
|
Mr Anderson
|
 |
« Reply #10 on: January 16, 2012, 07:45:40 PM » |
|
That bugs the hell out of me when I get something (eg. a WP theme for one of my own sites) and find that's the case. Having to set the margins/padding for paragraphs, lists, headers etc. is surely far more work that just removing it for a specific element? I guess it's whatever suits but IMO you're making extra work by removing margin/padding off an element that you're going to want and have to add again.
Also makes it harder to read unless you continually bear in mind that the margin/padding has been removed globally. Fine if you're the original developer, not necessarily so if you're working with someone else's code.
If all browsers worked the same it wouldn't be necessary, but they don't so it is. Besides which, why let a browser decide how much space you should have between your paragraphs etc., it's enough to make a typographer cry.
|
|
|
|
|
Logged
|
|
|
|
|
sarahA
|
 |
« Reply #11 on: January 16, 2012, 07:56:25 PM » |
|
It's only my opinion and the way I prefer to work.
|
|
|
|
|
Logged
|
|
|
|
suedenem
|
 |
« Reply #12 on: January 16, 2012, 08:51:25 PM » |
|
I resisted the CSS reset for quite a while - after all, do websites need to look exactly the same in every browser? There's also the argument that the user has chosen to use a particular browser, and forcing display preferences upon the user is touching upon arrogance. However, I normally find quite quickly that I have to add in a CSS reset because some of the x-browser differences aren't acceptable, and debugging & fixes are easier with a reset. The reasons for using it are two-fold; firstly, it helps x-browser consistency, which helps manage client expectations, and secondly it's a cost thing - far from adding unnecessary work, it saves unnecessary re-work. Likewise, I tend to prefer working with sites that I wasn't initially involved with when they have a reset. That way, it's working from a predictable base, which makes debugging and building upon an easier process. I stop short of resetting font sizes though; they are invariably set early on, which almost works as a reset anyway. Oh, and I dislike working with ems, which again limits the value of resetting font sizes. Whatever - you might want to clear your floats by adding a clearing element before the closing div#container.
|
|
|
|
|
Logged
|
So this SEO copywriter walks into a bar, grill, pub, public house, Irish bar, bartender, drinks, beer, wine, liquor...
Beware my weird, cross-dressing comment's; they are pretty standard examples of trolling.
|
|
|
|
sarahA
|
 |
« Reply #13 on: January 17, 2012, 12:09:22 PM » |
|
I don't touch any 'work' CSS. Mr A tells me off when I've edited his CSS files 
|
|
|
|
|
Logged
|
|
|
|
|
Mr Anderson
|
 |
« Reply #14 on: January 17, 2012, 02:00:33 PM » |
|
I don't touch any 'work' CSS. Mr A tells me off when I've edited his CSS files  And they all have the margin and padding reset, so let that be a lesson to you  The reasons for using it are two-fold; firstly, it helps x-browser consistency, which helps manage client expectations, and secondly it's a cost thing - far from adding unnecessary work, it saves unnecessary re-work.
That's pretty much my own reasoning, with the latter being the more important to me than the former but both being a consideration.
|
|
|
|
|
Logged
|
|
|
|
|
sarahA
|
 |
« Reply #15 on: January 17, 2012, 04:09:27 PM » |
|
Well, as a CSS 'dabbler', I find it causes more headaches, but as I said, each to their own.
|
|
|
|
|
Logged
|
|
|
|
|
Steve Lampkins
|
 |
« Reply #16 on: January 17, 2012, 04:19:06 PM » |
|
♫ let's call the whole thing off ♫
|
|
|
|
|
Logged
|
|
|
|
suedenem
|
 |
« Reply #17 on: January 17, 2012, 04:43:03 PM » |
|
Well, as a CSS 'dabbler', I find it causes more headaches, but as I said, each to their own.
Tsk. Never trust a lay person.
|
|
|
|
|
Logged
|
So this SEO copywriter walks into a bar, grill, pub, public house, Irish bar, bartender, drinks, beer, wine, liquor...
Beware my weird, cross-dressing comment's; they are pretty standard examples of trolling.
|
|
|
|
familychoice
|
 |
« Reply #18 on: January 17, 2012, 05:09:14 PM » |
|
I use the reset thing, not that I know anything about it.
|
|
|
|
|
Logged
|
Just another shite talking, unemployable Walter Mitty character living in a blinkered brassed-off, ITV-drama-esque world...
|
|
|
|
sarahA
|
 |
« Reply #19 on: January 17, 2012, 06:15:59 PM » |
|
Well, as a CSS 'dabbler', I find it causes more headaches, but as I said, each to their own.
Tsk. Never trust a lay person.  I can write CSS from start to finish (I'm sure you realise this), it's just not my main job so I don't 
|
|
|
|
|
Logged
|
|
|
|
|