View unanswered posts | View active topics
It is currently Mon Jun 17, 2024 5:49 am
|
Page 1 of 1
|
[ 12 posts ] |
|
Author |
Message |
Angelic
Doesn't have much of a life
Joined: Thu Apr 23, 2009 7:16 pm Posts: 704 Location: Leeds, UK
|
I know this isn't exactly "meeting place" material, but I hope the attachment will help. Basically i'm doing some website coding for a module where i've got to design a website. The lectures weren't exactly helpful, so i've been teaching myself using t'internet and it's been slow going. One thing I can't work out how to do is to create a box which will contain everything and that is centered (much like THIS page. Anyone good at website programming? *looks hopeful and offers pie*
|
Mon May 04, 2009 7:32 pm |
|
|
finlay666
Spends far too much time on here
Joined: Thu Apr 23, 2009 9:40 pm Posts: 4876 Location: Newcastle
|
By 'white box' that is centred do you mean the white and all that is contained within it? If so it looks like a relative CSS style setting with say 5% left start and 95% right finish, then you whack all the stuff you want inside it. set a 1% border top & bottom say. And Bob is your proverbial man from U.N.C.L.E. .... or something like that Did you not look at the source for the page? there would be a link somewhere in the source to the CSS if it is referenced and not embedded. the CSS file is : HEREThe actual source of the site will help you find out what does what
_________________TwitterCharlie Brooker: Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.
|
Mon May 04, 2009 7:42 pm |
|
|
big_D
What's a life?
Joined: Thu Apr 23, 2009 8:25 pm Posts: 10691 Location: Bramsche
|
You just need to put the content into its own <div> tag, giving it either an id or a class (class is generally preferred, but if it is unique on the page, id is okay as well. Then set up the CSS for the div's class or id. E.g. in you xhtml file: In your css file: Just fill in the code you need to apply the formatting. A good place to start is w3schools.com
_________________ "Do you know what this is? Hmm? No, I can see you do not. You have that vacant look in your eyes, which says hold my head to your ear, you will hear the sea!" - Londo Molari
Executive Producer No Agenda Show 246
|
Mon May 04, 2009 7:44 pm |
|
|
EddArmitage
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 9:40 pm Posts: 5288 Location: ln -s /London ~
|
Why so, out of curiosity? I always use ID if it is unique, to force it to be unique and stop it being used where it's not intended to be. Edd
|
Mon May 04, 2009 9:18 pm |
|
|
Angelic
Doesn't have much of a life
Joined: Thu Apr 23, 2009 7:16 pm Posts: 704 Location: Leeds, UK
|
Okay i've put it in it's own class, and did "left: 20%;" but it is still aligning left, very strange. How do I make it centre? =/
But thanks for the boxage help =) I sorta figured it out just as I posted but didn't consider doing it as a percentage (which I think I might do it as now).
|
Mon May 04, 2009 9:35 pm |
|
|
forquare1
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 6:36 pm Posts: 5150 Location: /dev/tty0
|
We were always told one would use an ID for a specific thing, it could be specific to a single page, or a site-wide specific thing like the main body div. One would use a class for less specialist circumstances, like a class for making any picture float left or right.
|
Mon May 04, 2009 9:54 pm |
|
|
Nick
Spends far too much time on here
Joined: Thu Apr 23, 2009 11:36 pm Posts: 3527 Location: Portsmouth
|
Yeah, exactly. Using a class in this instance would be pretty pointless. You would also need the "line position:relative;" in the css for that <div>
_________________
|
Mon May 04, 2009 10:35 pm |
|
|
big_D
What's a life?
Joined: Thu Apr 23, 2009 8:25 pm Posts: 10691 Location: Bramsche
|
Yep. If the item can be used more than once, then it should be a class. If it is unique, use Id. Also, if you have several input fields on a form, for example, each would have an Id, but you would give them all the same class, so that you only need to define the style once and they all look the same... Yes, position:relative is also needed. I didn't want to include all of the CSS he would need, just get him started, so that he actually learnt how it works and how to research it on his own. As a hint, Angelic, you will probably need to define the width and height of the body and / or html styles: For example.
_________________ "Do you know what this is? Hmm? No, I can see you do not. You have that vacant look in your eyes, which says hold my head to your ear, you will hear the sea!" - Londo Molari
Executive Producer No Agenda Show 246
|
Tue May 05, 2009 4:43 am |
|
|
EddArmitage
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 9:40 pm Posts: 5288 Location: ln -s /London ~
|
Well yes, I agree entirely, but I still don't see why class is "preferred". Surely ID is preferred, where it is suitable, but in most cases you have to use class or duplicate lots and lots of CSS, which is obviously *VERY* bad. Edd
|
Tue May 05, 2009 11:10 am |
|
|
Nick
Spends far too much time on here
Joined: Thu Apr 23, 2009 11:36 pm Posts: 3527 Location: Portsmouth
|
It's interesting how people do things differently. I would always prefer to refer to the input element itslef in the css. If there was more than one form, I'd give each form an ID and do it that way. I tend to use as few classes as possible. I think it's because I like to keep the HTML as clean as possible and also because classes are mis-used so often - it's a pet hate of mine.
_________________
|
Tue May 05, 2009 11:21 am |
|
|
Nick
Spends far too much time on here
Joined: Thu Apr 23, 2009 11:36 pm Posts: 3527 Location: Portsmouth
|
I agree. As I hinted in my previous post, for me a class is NEVER preferred. Of course, they are sometimes the best option, but very rarely.
_________________
|
Tue May 05, 2009 11:25 am |
|
|
EddArmitage
I haven't seen my friends in so long
Joined: Thu Apr 23, 2009 9:40 pm Posts: 5288 Location: ln -s /London ~
|
Yes, just read your post and we're on the self-same wavelength. Edd
|
Tue May 05, 2009 4:44 pm |
|
|
|
Page 1 of 1
|
[ 12 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 74 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum
|
|