Hello, there is a page, header, leftbloc, content, rightbloc, footer, well, I would like to make it possible to hide the LEFT block (leftbloc) on demand while expanding the content block so that there is no empty space

  • The tags you have written "php" and "html". Do you want to do only by these means? - Deonis
  • Well, as if yes, but if I understand correctly, then I can't do without javascripts or jquery
  • Well, so "on the vskidku", then theoretically you can use either the session, or cookies. Those. after nazatiya to any button "Hide", save in the cookie / session the value by which you will be guided: show the user a sidebar or not. It’s crazy, but I don’t see any other way out. - Deonis
  • This is a simple page without mysql and php - kiberchainik
  • one
    We arrived ... And why did they indicate in the tags "php"? In this case, or JS / jQuery to use, or without options. - Deonis

2 answers 2

Save as PHP. See how it behaves:

<!DOCTYPE html> <html lang="ru"> <header> <title>Пример</title> <style> header, footer { border: 1px solid #000; margin: 1em 0; clear: both; } #leftbloc { float: left; margin-right: 1em; background: #ccc; width: 5em; } #rightbloc { float: right; margin-right: 1em; background: #ccc; width: 5em; } #content { margin: <?php echo $_GET['left'] != 'hide' ? '0 6em' : '0 6em 0 0' ?>; } </style> </header> <body> <header> Шапка </header> <?php if ($_GET['left'] != 'hide') { ?> <section id="leftbloc"> Левая колонка </section> <?php } ?> <section id="rightbloc"> Правая колонка </section> <section id="content"> <p>Здравствуйте, есть страница, header, leftbloc, content, rightbloc, footer, ну вот я бы хотел сделать возможным скрывать по требованию ЛЕВЫЙ блок (leftbloc) при этом блок контента чтоб асширялся, чтоб не оставалось пустого места <ul> <li><a href="?left=hide">Без левой колонки</a> <li><a href="?left=show">С левой колонкой</a> </ul> </section> <footer> Подвал </footer> </body> </html> 
  • Thanks a lot, really helped! - kiberchainik

PHP has nothing to do with it. This can be done in JS or CSS. After you hide your left block, add its width to the content block and that's it.

  • I am both zero and there, please help - kiberchainik