News:

SMF 2.1.6 has been released! Take it for a spin! Read more.

Main Menu

1.1 RC2 Default - Can I add a Minimum Width?

Started by charlwillia6, January 15, 2006, 11:27:33 PM

Previous topic - Next topic

charlwillia6

Hi,

I love the new default theme and have changed the color using Mystics color variations.  My only other question now, is can I someone how add a minimum width to the theme.  I notice that if I make the browser window smaller, the theme keeps getting smaller.  If I wanted to keep it from getting smaller, say at 780px's, what code would I need to add and where?  Has anyone else thought of this?

Charles

charlwillia6

Now I would just like to be able to make the default template fixed width (anyone?).  I have looked through the template and have played around.  I can successfully remove the header and tweak things, but I cannot understand how to make the forum fixed width. 

Charles

forsakenlad

Allright, this will need some editing, first of all open up your style.css and search for this:

.mirrortab_back a:hover
{
color: #e0e0ff;
text-decoration: none;
}


And add after:

/* This is the place where we define the width of our forum */
.maindiv
{
width: 760px;
text-align: left;
}


Allright, you should type in the value for the choice of your width, now open up index.template.php and search for this:

<body>';

And replace it with this:

<body>
        <center>
        <div class="maindiv">';


Then search for this:

</div>
</body></html>';


And replace it with this:

</div>
</div>
</center>
</body></html>';


Hope it helps ;)
Eren "forsakenlad" Yaşarkurt
SMF Friend & Former Team Member

Nyx

Hi, I tested this on my forum in 990px but look



I want it centered :(

forsakenlad

Weird, it worked when I tested it, can you apply it again and give me a link?
Eren "forsakenlad" Yaşarkurt
SMF Friend & Former Team Member


forsakenlad

Well for it to be centered it should have to be shrinked first, try a smaller size ;)
Eren "forsakenlad" Yaşarkurt
SMF Friend & Former Team Member

Nyx


Nyx


forsakenlad

There is the limit of your monitor which we cannot change :)
Eren "forsakenlad" Yaşarkurt
SMF Friend & Former Team Member

charlwillia6

It took me a little while to get back here, but thank you for the help.  I had tried to make the changes directly to the divs and tables in that file, but I wll try this out.  Thank you again.

orbit

#11
You can also go into the style.css file in the 'themes' folder and modify the 'body' style by setting a percent of body width and then center the body by changing the margin settings as well. The exerpt below is from my forums' CSS.

As a note, I'm still using 1.0.6 but would guess that this trick will work in 1.1 RC as well.

body
{
   width: 70%;
   background-image: url(../../../images/bgimages/bgblack.gif);
   background-repeat: repeat;
   background-color: #FFFFFF;
   float: right;
   border-top-width: 2px;
   border-right-width: 3px;
   border-bottom-width: 3px;
   border-left-width: 2px;
   border-top-style: solid;
   border-right-style: solid;
   border-bottom-style: solid;
   border-left-style: solid;
   border-top-color: #999999;
   border-right-color: #666666;
   border-bottom-color: #666666;
   border-left-color: #999999;
   margin-top: 10px;
   margin-right: 15%;
   margin-bottom: 10px;
   margin-left: 15%;
}


You'll see that I set my forum body width at 70% of browser screen width and the margins on the right and left are each set at 15%. This will place the forum body in the center of the screen for any monitor resolution. I have the body set to float to the right, but a left float will work as well. Probably don't need this at all but I left it in there anyway.

I also created a 'shadow' effect by adding different width and color borders to the four sides of the body. A cheap but effective way to achieve the desired result.

The only thing you'll have to be aware of is the width of the image you use in the header. If it's fairly wide, like 800 px, you'll have to adjust the width percentage of the body or downsize the image a bit.


charlwillia6

#12
Great, your instructions worked great, but now I have one problem with it.  The bottom area that lists the most recent posts, calendar events, etc., is not staying 780px like I want it to. The recent posts section is making the box extend out past my fixed-width.  The longer the title of the most recent post, the further the table is extended past my fixed width.  How do I fix that?

EDIT:  NEVERMIND - I figured it out.  It was in the boardindex.template.php file.  I just searched for 'nowrap' and removed the nowrap :nowrap; style in regards to the latest post section of the Info Center.  That fixed the problem.  Everything seems to work great now.


garrador

I am trying to center the babylon theme and well, I have tried this and failed miserably. Anyone have any tips. this is what I am currently working with hxxp:prevailed-guild.net/forum/ [nonactive]

Advertisement: