Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

How to strech the content to 100% of the page width, when there's nothing on the sidebar?


Go to End


2 Posts   1236 Views

Avatar
John Doe

Community Member, 1 Post

4 June 2008 at 12:18am

Edited: 04/06/2008 12:20am

Hi everyone,

I have just set up a new site and find it quite annoying that the main content takes up only about 2/3 of the whole width, even when I have nothing in the sidebar.

Anyone knows how to solve this problem? TIA!

You might have a look at my site at www.giit-trans.com, thank you!

Avatar
UncleCheese

Forum Moderator, 4102 Posts

5 June 2008 at 6:59am

I think it looks good. It would be awkward to remove the sidebar all of a sudden just because there's no content. And 100% width for that content will get awfully hard to read. That's at least true in the Roman alphabet. Maybe not for you if you're reading top to bottom?

Anyway, one way to do it would be this:

<% if SidebarContent %>
<div id="sidebar">content here</div>
<% end_if %>

Then you'd have to write a function in your controller to determine whether SidebarContent reutrns true or false.

But again, I don't see a need to do that. I think it would look awkward.