A
A
apaicer2018-02-07 00:51:06
css
apaicer, 2018-02-07 00:51:06

Why is the link full width of the page?

There are links that are wrapped in a container, but they still stretch to the full width of the screen. If you write display: inline-block; they (links) slide down below the footer and cannot be raised through the margin. What could be the problem?
My NewsBlock class

<?php 
if ($Module == 'category' and $_GET['id'] != 1 and $_GET['id'] != 2 and $_GET['id'] != 3) MessageSend(1, 'Такой категории не существует.', '/news');
$Param['page'] += 0;
Head('Новости');
?>
<body>
<div id="wrapper">

<?php  Menu();
MessageShow()?> 
<?php 
if ($_SESSION['USER_GROUP'] == 2) echo '<a href="/news/add"><div class="button15">Добавить новость</a></div>'
?>
    
<?php 
if (!$Module or $Module == 'main') {
$Param1 = 'SELECT `id`, `name`, `added`, `date` FROM `news` ORDER BY `id` DESC LIMIT 0, 5';
} else if ($Module == 'category') {
$Param1 = 'SELECT `id`, `name`, `added`, `date` FROM `news` WHERE `cat` = '.$_GET['id'].' ORDER BY `id` DESC LIMIT 0, 5';
}


$Query = mysqli_query($CONNECT, $Param1);
while ($Row = mysqli_fetch_assoc($Query)) echo '<a href="/news/material/?id='.$Row['id'].'"><b><div class="NewsBlock"></b><span>'.$Row['name'].'</span>Добавил: '.$Row['added'].' | '.$Row['date'].' </div></a>';
?>





</div>

here is the css
.NewsBlock {
   
  background: #f2f2f2;
  padding: 10px;
  color: #000000;
  margin: 10px;
  border-radius: 2px;
  font-size: 1.2em;
  height: 50px;
  width: 50%;
  border: 1px solid black;
  margin-left: 26%;
  margin-top: 30px;
  border-radius: 2px;
  color: green;	
  overflow: hidden;
  font-family: 'Roboto Slab', serif;
  

}

I'll be waiting for your response!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dima Polos, 2018-02-07
@apaicer

Tags are closed incorrectly.

<a>
      <div class="button15">Добавить новость</a> //? 
</div>

We opened а, then opened the div, closed аit, and then closed the div, we must first close the div inside.
<a>
     <b><div class="NewsBlock"></b>
             <span></span>
      </div>
</a>

Here is a similar situation, the b tag was opened, a block element was nested in it, and closed immediately after opening, but not the entire block.
I think that's the point.
Correct like this:
<a>
      <div class="button15">Добавить новость</div>
</a>

There, too, similarly, close the tags correctly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question