I'm using the following code in body section.
<center><a href="contact.html" class="button large hpbottom">Get Started</a></center>
Is there any alternative for <center>
tag?
How can I make it center without using <center>
tag?
You can't make the div a link itself, but you can make an <a> tag act as a block , the same behaviour a <div> has. You can then set the width and height on it. However, this doesn't make a 'div' into a link. It makes a link into a block element.
If you absolutely need to use JavaScript, one way is to find a link inside the div and go to its href when the div is clicked. This is with jQuery: $(". myBox").
The <div> tag defines a division or a section in an HTML document. The <div> tag is used as a container for HTML elements - which is then styled with CSS or manipulated with JavaScript. The <div> tag is easily styled by using the class or id attribute. Any sort of content can be put inside the <div> tag!
The answer is definitely yes, but you will need to write javascript code for it. We can use a click handler on the div element to make it clickable.
Add text-align:center;display:block;
to the css class. Better than setting a style on the controls themselves. If you want to change it you do so in one place.
You can do this:
<div style="text-align: center">
<a href="contact.html" class="button large hpbottom">Get Started</a>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With