-7

I have this ad code to put on my website, but I need to put it at the bottom of the page (and centered). At the moment I have this code:

<center>
<script type="text/javascript">
var var1 = "728";
var var2 = "90";
var var3 = "728x90";
var var4 = "21676";
var var5 = "d119a02021ce7f2804da25fd308f24b0";
</script><script type="text/javascript"src="//cdn.adshexa.com/show_ads.php"></script>
</center>

How could I name the piece of code so I could edit it like

.nameofclass {
    position: absolute;
    left: 100px;
    top: 150px;
}

But the left and top of the position be the bottom middle.

So I pretty much need to know how to name it a class then in the CSS change it to the bottom middle position.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Rulen24
  • 3
  • 1
  • 4
  • 4
    Don't use the `
    ` element. It was removed years ago. You can wrap your ad script in a div element and give the div a class or ID bearing in mind that the script your'e inserting might insert CSS of its own.
    – j08691 Aug 26 '15 at 13:41
  • @j08691 Please could you say how in an answer of the question, write out the code. thanks – Rulen24 Aug 26 '15 at 13:42
  • Hi welcome to stackoverflow, it seems that you are an absolute beginner to HTML etc. I recommend you do more research and then come back to us afterwards. – 099 Aug 26 '15 at 13:43
  • @099 Ye, the way to help me is to, funnily enough, actually help me with the code. That's how the world works, you help someone and then they relay the information :) – Rulen24 Aug 26 '15 at 13:45
  • You can also let this script a first time run in your browser. After viewing where is your ad, you open the Developper Console (depending on your browser), and search for the ad HTML bloc tag. If it has an Id or a classname, you can use it. Beware of the random id/classname by the way. – Anwar Aug 26 '15 at 13:45
  • @Rulen24 Are you asking how to give an HTML element a CSS class name? – TylerH Aug 26 '15 at 13:45
  • 2
    @Rulen24 unfortunately that isn't how stackoverflow works. Feel free to read: [How to ask](http://stackoverflow.com/help/how-to-ask) – 099 Aug 26 '15 at 13:46
  • @TylerH I'm asking how to give that piece of code a css class name, yes. I'm new. – Rulen24 Aug 26 '15 at 13:51
  • @Rulen24 In that case I'd recommend following [this tutorial](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/What_is_CSS) on CSS and how to use it. It answers your question on about page five. – TylerH Aug 26 '15 at 13:55
  • That's what I really hate about this site. It's supposed to be a site where people can ask questions or advice on their code, and get help, but sometimes, it feels like everyone else is against you. I hate how everyone tries to show off what they know, like they're the one that invented programming, or even computers. – Jeremy Board Aug 26 '15 at 14:25
  • @JeremyBoard You just read my mind – Rulen24 Aug 26 '15 at 15:51
  • @Rulen24 yeah I figured out if you just ask your questions, or answer other people's, and just don't care what other people say or think, it's a whole lot easier :) – Jeremy Board Aug 27 '15 at 00:55

1 Answers1

0

You'll want something like:

<div class="nameofclass">Some contents</div>

Avoid the center tag; it's not supported. If you need the element to appear centered, do it in the CSS.

Matt
  • 58
  • 6
  • Are you suggesting If so, it wont work for me. – Rulen24 Aug 26 '15 at 14:06
  • Ah wait, it is. Now I need to position it, could you link me to a site that could show me how to position it in the bottom middle please? } .advert { Then the position for bottom middle which I don't know sorry :D } – Rulen24 Aug 26 '15 at 14:13
  • I think [this](http://stackoverflow.com/questions/9383163/how-do-i-position-a-div-at-the-bottom-center-of-the-screen) question is probably what you're looking for. Sticky elements at the bottom of a page are also addressed [here](http://stackoverflow.com/questions/5587740/footer-position-bottom-and-center) and [here](http://stackoverflow.com/questions/5189238/how-to-make-a-footer-fixed-in-the-page-bottom). – Matt Aug 26 '15 at 14:27