CSS Wrapper

Steeevoe

New Member
Messages
103
Reaction score
0
Points
0
I see lots of people use this in their websites around most of their HTML!

I don't understand what they do. Are they used to make the website centered? What do you need to make them?

At the moment on my webpage I am using a table to get everything centered. Is there a better way?
 

VPmase

New Member
Messages
914
Reaction score
0
Points
0
Divs are better than talbes. Tables take longer to load than divs but divs are harder to organize lol.
 

freecrm

New Member
Messages
629
Reaction score
0
Points
0
From a personal point of view, I always thought that tables were easier to understand.

divs are the way to go because they are alot more flexible. However, there are many issues regarding cross-browser compatibility.

In a nutshell, a <div> is the start of a division, terminated or closed by </div>

Within the css styling (which can be specified in the same page or in one common page for all of your site), you can specify how this <div> looks. Divs tend to be more powerful as a result.

I have just changed all of my site from tables to divs.

I'll give a very quick example.

In tables, for the whole page, you might use the following:

HTML:
<table width="100">
<tr>
<td>&nbsp;</td>
<td>

<p>Some content</p>

</td>
<td>&nbsp;</td>
</tr>
</table>

or something like that (too tired to think)

with divs and styling, you use several divs to split it up.

i.e.

HTML:
<div id="wrapper">
Some content
</div>


which looks a lot simpler, but you then have to tell your div what it looks like (in the head).

HTML:
<style type="text/css">
#wrapper{
border: 1px solid #000;
width: 750px;
margin-left: auto;
margin-right:auto;
}
</style>

This style specifies the look for the one-off "div" called "wrapper" with a single line black border, 750 pixels wide and automatically centres.

One major advantage of divs is the ability to change the look of a whole site based on one css style page.

For instance, if you were to use the same divs in multiple pages, with a tag in each page head like:
HTML:
<link href="../css/mystyle.css" rel="stylesheet" type="text/css" />

You can then create one style page (called mystyle.css). In this page, you might structure it as follows:

HTML:
@charset "utf-8";
/* CSS Document */

body{
background: #99cccc;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #000;
}

#wrapper{

more styling
}

column{

more styling
}

etc...

When you change the single css style page, every page that uses this style page will change accordingly.

Good no?

_____

By the way, when you get your head round that, you might like to se this post which may help more.

http://forums.x10hosting.com/tutorials/94826-css-testing.html
 
Last edited:

JKoltner

New Member
Messages
23
Reaction score
0
Points
0
You've gotten some good replies here, but I'll also add:

-- The contemporary idea with web pages is that HTML is used for the "substance" or content of your web page and CSS is used for the "style" or layout. This is kind of the difference between something like MS Word and LaTeX: The way most people use the former, they combine the content with the layout all in one, whereas in the later you're forcibly made to separate the two. (Newer versions of Word do let you separate the two, although that's not the way most people operate unless they're writing theses or books.)
-- For small web sites that don't change a lot, arguably ignoring CSS can actually be a bit faster and easier. For larger, dynamic web sites, CSS with divs and spans saves a lot of time over having to constantly shuffle tables around. If you go to college these days, they're big on CSS since they're assuming everyone's going to end up working for big companies with big web sites. If you're doing your own site though, hey, use whichever you like better.
-- One significant advantage of CSS is that it makes it a lot easier for small-screen devices (e.g., mobile phones) to reformat the web page for viewing in a still somewhat sensible manner. Heck, CSS even lets you specify different style files depending on the type of device that's viewing your page, if they're printing the page or not, etc., so again there's a tremendous amount of flexibility and power there... if you want it.

---Joel
 

claes89

New Member
Messages
7
Reaction score
0
Points
0
Your index file isn't working for me, but your indextest.html looks centered in Safari :)
 

Steeevoe

New Member
Messages
103
Reaction score
0
Points
0
I have updated the original index file to .php for recent changes I have made!

Ok, does anyone know how to get the column centered in internet explorer, or does is it not possible with IE?
 

freecrm

New Member
Messages
629
Reaction score
0
Points
0
Hi Steeevo

I am now testing this in the dreaded IE6!

Weirdly, your indextest isn't working but the index is!

I had a quick look at your css but nothing stood out as being completely wrong.

I have spent a long time on this and I would recommend that you take a look at the css on my site and the way it is structured. I have tested this in IE6, IE7, Chrome and FF. Opera is the only possible problematic area.



Ooooh - scrub the above - try changing your doc type (at the top of the page)... you're using an old version.

Try this...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">


_____________

Also this bit..

Code:
<DIV id=announcements>
	<CENTER><A href="events.html"><H1>Upcomming event: 1st April: Swap Meet, Click Here For Information</H1></A><CENTER>
    </DIV>

Firstly, you could specify the text centred in the css with "text-align: center;"

Secondly, you haven't closed off the center at the end ... "</center>" which will give you problems lower down the page.
 
Last edited:

Otaku Ichise

New Member
Messages
64
Reaction score
0
Points
0
What you see is a div with an id called Wrapper (we normaly add this do decorate more something in your website)
Here is my website centered with one div (css atribute: margin-left:auto margin-right:auto) containing all other div always:
http://otakushrine.elementfx.com/
 

freecrm

New Member
Messages
629
Reaction score
0
Points
0
What you see is a div with an id called Wrapper (we normaly add this do decorate more something in your website)
Here is my website centered with one div (css atribute: margin-left:auto margin-right:auto) containing all other div always:
http://otakushrine.elementfx.com/

I think you'll find that this has already been covered earlier in the post. The issue now is with cross-browser compatibility.
 

Otaku Ichise

New Member
Messages
64
Reaction score
0
Points
0
I think you'll find that this has already been covered earlier in the post. The issue now is with cross-browser compatibility.

lol if thats so, then about the cross-browser compatibility is tricking with css itself xD
 

Steeevoe

New Member
Messages
103
Reaction score
0
Points
0
The document type thing seems to have done the job! Just means that everything is now squee-wiff :| That shouldn't take too long to sort out.

Thanks for the help :D
 

kbjradmin

New Member
Messages
512
Reaction score
2
Points
0
I know this is a closed issue, but i didn't want to open a new thread about the same topic.

this is my site: http://portfolio.kbjr.x10hosting.com/

as you can see, the wrapper div (the box in the middle) is centered fine, but the rest of the stuff inside it will not center.

please help, i haven't had this problem before and am completely lost. i think it has something to do with the fact that the divs inside are positioned absolutely with left of 0, but it hasn't done this to me before.

edit:
by the way, here is the css for my wrapper div (called main):
Code:
#main{
	height: 510px;
	width: 1010px;
	margin-left: auto;
	margin-right: auto;
	background: url('media/mainbox.png');
}
 
Last edited:

gomarc

Member
Messages
516
Reaction score
18
Points
18
I know this is a closed issue, but i didn't want to open a new thread about the same topic.

this is my site: http://portfolio.kbjr.x10hosting.com/

as you can see, the wrapper div (the box in the middle) is centered fine, but the rest of the stuff inside it will not center.

please help, i haven't had this problem before and am completely lost. i think it has something to do with the fact that the divs inside are positioned absolutely with left of 0, but it hasn't done this to me before.

edit:
by the way, here is the css for my wrapper div (called main):

Try this:
Code:
p.para {

text-align:justify;
 

Steeevoe

New Member
Messages
103
Reaction score
0
Points
0
I have another issue. Please can you look at bmac.exofire.net/indextest.php

I would like the announcment bar that is a link under the id of announcements to be all clickable like the banner buttons at the top of the page. I have been fiddling with values and I can't get it to work :(
 

freecrm

New Member
Messages
629
Reaction score
0
Points
0
I have another issue. Please can you look at bmac.exofire.net/indextest.php

I would like the announcment bar that is a link under the id of announcements to be all clickable like the banner buttons at the top of the page. I have been fiddling with values and I can't get it to work :(

Page doesn't exist I'm afraid!

However, if you're thinking what I thin your thinking, might want to look at the way the link has been structured. I don't know if you copied a navigation menu structure.

If its pure css, Its probably something like this...

Code:
<ul id="something>
<li><a href="urllink">text for link</a></li>
etc..
etc...

</ul>

The term ul id="something" will refer to a piece in your css that has a hover attribute

i.e.

a:hover{
border: 5px solid #ff3300;
}

or something link this.

All you need to do is to make sure that your new links are within a <ul> (unordered list) where the <li> lines are the divisions that will have the css attribute.

Try to play with this idea...
 
Last edited:

Otaku Ichise

New Member
Messages
64
Reaction score
0
Points
0
lol if your giving an absolute position to a div its normaly it wont center, specialy when you gave margin-left:0 (meaning it will be place absolutly there on left and shall not move at all)

and as said below you can eitheir give atribute align to div both html or css way to center content inside div (<div align="center"></div> or {align:center} on css external file)

I personaly dont use any kind of the css position atribute to a layout, unless its something to hide and show on hover css atribute.
 
Last edited:
Top