Tips for aligning a Twitter button and a regular button side by side on a horizontal

I have two buttons - one for Twitter and the other a normal submit button. I am struggling to align them horizontally on the same line.

After experimenting with various combinations of margin settings for ".buttonLine", ".twitter-share-button", and "#newQuoteButton", I still can't get them to line up side by side.

All I want is to place them in a horizontal line, with one on the left and the other on the right.

Please advise me on how to achieve this alignment.

Check out the demo fiddle at this link

Here's the code:

window.twttr = (function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0],
    t = window.twttr || {};
  if (d.getElementById(id)) return t;
  js = d.createElement(s);
  js.id = id;
  js.src = "https://platform.twitter.com/widgets.js";
  fjs.parentNode.insertBefore(js, fjs);

  t._e = [];
  t.ready = function(f) {
    t._e.push(f);
  };

  return t;
}(document, "script", "twitter-wjs"));

function myFunction() {
  //nothing
}
.my-content {
  background-color: light-blue;
  margin: 250px 50px 100px 50px;
  border-radius: 10px;
}
.quote {
  margin: 0px 50px 0px 50px;
  text-align: center;
}
.quoteBy {
  margin: 0px 25px 0px 0px;
  text-align: right;
}
.buttonLine {
  margin: 50px 0px 0px 0px;
}
.twitter-share-button {
  margin: 0px 0px 0px 50px;
}
#newQuoteButton {
  margin: 0px 200px 100px 0px;
}
<!DOCTYPE html>
<html lang="en">

<head>
  <title>PageTitle</title>

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />

</head>

<body>
  <div class="container-fluid">
    <div class="my-content">
      <h1 class="quote" id="idQuote">Quick Brown Fox Jumped Over The Lazy Dog! Quick Brown Fox Jumped Over The Lazy Dog!</h1>
      <h4 class="quoteBy" id="idQuoteBy">....The Quick Fox</h4>
      <div class="buttonLine" style="clear:both">
        <a class="twitter-share-button" href="https://twitter.com/intent/tweet?text=Hello%20world" data-size="large">Tweet</a>
        <button id="newQuoteButton" onclick="myFunction()">New Quote</button>
      </div>
    </div>

    <footer>
      <p class="text-center">Compiled by: Someones Name</p>
    </footer>
  </div>

</body>

</html>

Answer №2

Give this a shot!

  #clickMeButton {
    position: absolute;
    bottom: 15px;
  } 

Answer №3

When it comes to Twitter buttons, customization options are limited. However, you can adjust the alignment of your own button to fit in seamlessly. One way to do this is by specifying a specific value for its vertical-align property. Give this a try:

#customButton {
  vertical-align: 0.5em;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Can you explain the variance between using 'npm i' and 'npm install'?

Can you explain the distinction between running npm i and npm install? Both commands are used to install all node Modules listed in the package.json file. While the purpose of both commands is clear - to install modules, there may be subtle differences be ...

Error: The function onSelectChange is not defined in this.props

Currently, I am attempting to connect a state from the Parent component App.jsx class App extends Component { constructor() { super(); this.state = { select: '', }; this.onSelectChange = this.onSelectChange.bind(this); ...

Serializing a collection of JavaScript promises for execution

What is the best method for serializing a group of promised function calls? var promised_functions = [ fn1, // execute this function fn2, // once the previous resolves, call this one fn3 // once the previous resolves, call this one ]; q.serialize ...

Does an href and click events both happen simultaneously?

JavaScript Purpose: Implement a series of loops and create anchor links with the 'href' attribute <a class="mui-control-item" v-for="(item, index) in dai" v-on:click ="abc(item)" :href="'#item'+(index+1)+ 'mobile'" ...

Creating a simulated class within a function utilizing Jest

Currently, I am in the process of testing a controller that utilizes a class which functions like a Model. const getAllProductInfo = (request, response) => { const productInformation = new ProductModel().getAll(); response.status(200) resp ...

Ways to retrieve "this" while utilizing a service for handling HTTP response errors

I have a basic notification system in place: @Injectable({ providedIn: 'root', }) export class NotificationService { constructor(private snackBar: MatSnackBar) {} public showNotification(message: string, style: string = 'success' ...

React: Applying the active class to mapped elements

I have a component that iterates over an array to generate 10 navigation items. I want to implement an onClick method that will add an active class to the clicked item. Are there any best practices using Hooks or the newer React patterns for achieving this ...

Cordova encountered an error: Execution of inline script was denied due to violation of Content Security Policy directive

As I delve into the world of Cordova and jquery mobile, I encountered a perplexing error that reads: Refused to execute inline script because it violates the following Content Security Policy directive: "default-src 'self' data: gap: 'un ...

How can React.Js and Typescript be used to extract information from JSON files?

Hi there! I've been working with MongoDB, Mongoose, and React.Js for my project. One of the features I have is a page where users can view posts. When making a fetch request to the backend, I receive JSON data in response: { "post" ...

Open in a new tab for enhanced content formatting in Prismic on NextJs

In my Prismic RichText editor, I have included two files (terms and conditions) that I would like to open in a new tab. Unfortunately, Prismic does not offer an option like target _blank for this functionality. I am currently working with NextJs and Tail ...

Having issues with setting up nodejs on kali linux

Whenever I try to execute the configure script ./configure for nodejs installation, it fails to run successfully. Traceback (most recent call last): File "./configure", line 19, in <module> from distutils.spawn import find_executable ModuleN ...

Don't forget to save the selected date in the datepicker

I have a datepicker with two text fields: fromdate and todate. When I input the month of May and submit, then input another date, the default date should remain as May, instead of changing to the current month. Check out my code below. $(function() { ...

What could be causing Protractor to execute each line of code without delay?

Why is Protractor executing each line of code immediately? I have a non-angular webpage that I need my selenium-based automation to interact with. I've written selenium webdriver-js code to accomplish this task. For example, after logging in, the use ...

What is the best way to create a JQuery function that fills a div based on the selected option from an HTML select

Check out this simple JavaScript function below. <html> <head> <script> $(document).ready(function() { $.get('getImage.php', function(data) { $('#imageSelector').html("<select>" + d ...

Can an additional height be added to the equalizer to increase its height?

Is it feasible to append an additional 35px to the height determined by Foundation Equalizer? For instance, if Equalizer computes a height of 350px, I would like to increase it by 35px. This means that the resultant style should be height: 385px; instead ...

Setting a fixed width for content in CSS based on the size of the browser screen

I'm a newcomer to CSS and HTML and feeling a bit lost on this issue. My goal is to divide the screen into two halves, with one half taking up 50% of the browser screen width while the other half remains flexible. I want the content in one half to be f ...

Unable to function properly on Backbone.js, events have been rendered ineffective

I have recently created a view with the following code snippets: var app = app || {}; app.singleFlowerView = Backbone.View.extend({ tagName: 'article', className: 'flowerListItem', // specifies where to render the views templ ...

Create a custom calendar in Vue.js that allows you to dynamically disable specific

Recently, I've been working with vue.js and I've come across an issue regarding how to apply a class to past and future days of the current month. Specifically, for March, I need to disable days with numbers 24, 25, 26, 27, 28, 29 in the first ro ...

Is it possible to adjust the height of the navbar in Bootstrap?

Currently, I am in the process of replicating the mac OS navbar and am seeking guidance on resizing the navbar height and adjusting text size to around 12px. This is my first time working with bootstrap, so any assistance would be greatly appreciated. Addi ...

I'm a bit confused about what I'm doing - constantly running into errors stating "is not a function

I am facing an issue with passing one of my functions down as a prop in my component. When I try to do so, I get an error stating that this.nextScene is not a function. Below is a snippet from my component where the problem occurs: nextScene() { th ...