Jump to content
View in the app

A better way to browse. Learn more.

IPBMafia.ru - поддержка Invision Community, релизы, темы, плагины и приложения

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Центрирование рекламного блока

Featured Replies

Posted

Гряньте одним глазом на этот код. Правильно ли я  сделал центрирование? Ничего в общем коде не испоганю? Код будет находится в спец блоке для рекламы.

<html>
<head>
<style type="text/css">
h1 {text-align:center;}
</style>
</head>

<h1><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Реклама Google (250x360) -->
<ins class="adsbygoogle"
     style="display:inline-block;width:250px;height:360px"
     data-ad-client="ca-pub-0000000000000000"
     data-ad-slot="00000000000"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></h1>

Из того, что вычитал и понял, в body код заворачивать не нужно, т.к. уже будет находится в в нём.

 


 

Правильный код >внизу поста

<style type="text/css">
h1 {text-align:center;}
</style>

Этим стилем Вы испоганите все выводы вашего тега H1 на сайте (странице) - Конечно, если он присутствует. 

Не проще ли сделать отдельный div с стилем центровки содержимого ?  

  • Author
<style type="text/css">
h1 {text-align:center;}
</style>

Этим стилем Вы испоганите все выводы вашего тега H1 на сайте (странице) - Конечно, если он присутствует. 

Не проще ли сделать отдельный div с стилем центровки содержимого ?  

 

Подскажите код

  • Author


<div style="margin: 0 auto;">
тут ваше чудо
</div> 

в строке style= пишите нужный стиль :)

 

Заверните пожалуйста этот код, а то я сейчас доиграюсь) Не получается короче. Должен быть отцентрирован по вертикали.

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Реклама Google (250x360) -->
<ins class="adsbygoogle"
     style="display:inline-block;width:250px;height:360px"
     data-ad-client="ca-pub-0000000000000000"
     data-ad-slot="00000000000"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

А может просто в теги center заключить, не?

Валидацию не проходит. Пишут, что это старый способ и крайне не рекомендуется к использованию.

  • Author

Намудрил такой код) Работает. 

<div>
<if>
<li class='center'>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Реклама Google (250x360) -->
<ins class="adsbygoogle"
     style="display:inline-block;width:250px;height:360px"
     data-ad-client="ca-pub-0000000000000"
     data-ad-slot="000000000"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</li>
</if>
</div>

UPD: работал корявенько (был отступ сверху с рисованной точкой в углу)

Edited by AlexBrtn

Довольно не плохой вариант использования. 

Но для чего вы используете if ? оО 

 

PS: желательно увидеть страницу, где будет использоваться такой код (лучше в ЛС) что бы я предложил оптимальный вариант решения данного вопроса. 

  • Author
<div style="margin: 0px auto; width: 250px;">
</div>

Где width: это ширина блока 

 

Код в итоге для банера 250x360

<div style="margin: 0px auto; width: 250px;">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Реклама Google (250x360) -->
<ins class="adsbygoogle"
     style="display:inline-block;width:250px;height:360px"
     data-ad-client="ca-pub-0000000000000000"
     data-ad-slot="00000000000"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Ответить в этой теме...

Последние посетители 0

  • No registered users viewing this page.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.