Enlarge the icon so that it is bigger than the text, but ensure that both the icon and

Can someone please help me figure out how to align the icon with the text on this button?

Here is the current code I have:

.btn {
  -webkit-border-radius: 4;
  -moz-border-radius: 4;
  border-radius: 4px;
  font-family: 'Raleway', sans-serif;
  font-weight: 300;
  color: #ffffff;
  font-size: 17px;
  background: #72a031;
  display: inline-block;
  padding: 0px 30px 0px 25px;
  text-decoration: none;
}

.btn:hover {
  background: #61872c;
  text-decoration: none;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">
<button class='btn'>
    <i style="font-size: 1.73em; position: relative;" class="fab fa-steam-symbol"></i> Log in with Steam
</button>

I know it's a bit messy, but any help would be greatly appreciated!

Answer №1

To ensure that all elements/content inside the button are vertically aligned, you can easily apply the CSS rule vertical-align: middle using the selector .btn *:

.btn {
  -webkit-border-radius: 4;
  -moz-border-radius: 4;
  border-radius: 4px;
  font-family: 'Raleway', sans-serif;
  font-weight: 300;
  color: #ffffff;
  font-size: 17px;
  background: #72a031;
  display: inline-block;
  padding: 0px 30px 0px 25px;
  text-decoration: none;
}

.btn * {
  vertical-align: middle;
}

.btn:hover {
  background: #61872c;
  text-decoration: none;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">
<button class='btn'>
  <i style="font-size: 1.73em; position: relative;" class="fab fa-steam-symbol"></i> Log in with Steam
</button>

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

The Bootstrap button is experiencing difficulties with resizing

When utilizing the bootstrap CDN in conjunction with another bootstrap CSS example file located in the static directory, I encountered an issue while attempting to create a file input and submit button for a form. Despite my efforts, I was unable to adjust ...

What is the best method for efficiently wrapping contents within a div container?

On the website cjshayward.com/index_new.html, there is a div wrapped around the content of the body, which is approximately 1000 pixels wide. In Chrome and Firefox, the wrapper works perfectly for the top section of about 100 pixels. Further down the page, ...

Trouble with image click event in jQuery/JavaScript

I am having trouble with my HTML and JS code. I have added images to my HTML page and want to make it so that when the image is clicked, an alert box pops up. However, for some reason, my JavaScript isn't working as expected. Here is a snippet of my ...

CSS: Styling different <a href> tags to appear uniform within identical size containers

I currently have some links displayed on my webpage. These links are encapsulated within a border and have a background set for them, essentially creating a box around each one. <!DOCTYPE html> <style> a { background: #DDD; border: #BB ...

Unable to display the value of a server-side li element using JQuery

I am trying to retrieve values from a ul list that is populated from the database using server-side code. I want to display the li value in a jquery alert function, but it doesn't seem to be working as expected. Strangely, the same function works perf ...

Enable row selection in UI-Grid by clicking on a checkbox with AngularJS

I am a newcomer to angular js and I am looking to have the checkbox automatically selected when clicking on a row to edit that specific cell. I have implemented a cell template to display the checkbox in the UI-grid, but now, when I select a row, the row i ...

What could be the reason that the style tag present in this SVG is not impacting any of the elements?

My SVG file consists of a single element with a fill set to red: <svg width="100" height="60" viewBox="0 0 100 60" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill="red" d=&qu ...

Is there an alternative solution to resolving this issue with OTP verification?

Working on a verification system where users are redirected to verify their account with an OTP code after signing up. However, I encountered an issue where the code doesn't seem to work as expected and no error messages are being displayed. <?php ...

The upper margin is ineffective

Apologies, I am new to CSS. Here is the HTML code I have: <div class="box-A" >Box A content goes here</div> <div class="box-B" >Box B content goes here</div> I attempted to apply the following CSS to it: .box-A{ background-c ...

Distinguishing Design with CSS3

Here is the code snippet I am using: <table width="562" cellspacing="0" cellpadding="0" border="0" align="center" class="genericClass"> (nested tags are here) </table> These are the related styles in my stylesheet: table.genericClass a ...

What is the best way to position a bigger character directly above a smaller container?

My goal is to center a single character, using CSS, in a span that is smaller than the character itself. The setup I have is: <span id="A">X</span><span id="B">Y</span><span id="C">Z</span> All three spans are styled ...

Creating a seamless scrolling experience with a designated stopping point - here's how to achieve it!

I understand how to implement a scroll effect on an element with a specific class or ID. However, I am unsure of how to make the scrolling stop 20px above that element. I have seen examples using document.getElementById() to achieve this: function scr ...

Styling certain UL and LI elements with CSS properties

Greetings everyone! I constantly struggle when it comes to making my CSS cooperate. I have some code that involves using ul and li tags. However, I only want to apply that styling to specific sections of my HTML code rather than all instances of the ul and ...

Having difficulty adjusting the StartIcon margin within the MUI Button example, unable to override its values

Currently, I am facing an issue with the Button component in Material UI. Specifically, I am working with a Button that contains a StartIcon. Despite trying to modify the default margin provided by the StartIcon CSS, I have been unsuccessful so far. https: ...

html2canvas encountered a CORS error when trying to retrieve images from an external domain

I have been attempting to export a react component as a PDF file. Here are the steps I have followed: Converting the component into an image using html2canvas Creating a PDF document Attaching the image to the PDF The component contains images with URLs ...

Sustaining the hover effect background color when hovering over submenu options

I am currently working on a navigation menu that includes list items a, b, c, d, e, f. One issue I am facing is when a user hovers over the list item d, the submenu items like d1, d2, d3, d4, and d5 appear within the d section. However, the background col ...

Unable to display ChartJs within the same DIV on the webpage

I'm struggling to display the Pie Chart from ChartJs in the correct DIV when I click from the left DIV. Running the chart directly works fine, but I want them both on the same page in separate DIVs. I have separate HTML files for each link and they wo ...

Could it be that v-show does not function properly on elements that are not dynamic

I'm not experienced in web development and this is my first attempt at using a web framework. The framework I am currently learning is vue.js version 3. My goal: I want to create 4 app instances (nav, defaultApp, bootstrapApp, vueApp). When I select ...

What is the best way to eliminate all borders from a select box?

Is there a way to completely remove all borders from the selectbox using either CSS or JQuery? The code snippet is as follows: <select id="doctor_ch"> <option value="1" selected>One</option> <option value="2">Two</option& ...

The scaling feature in CSS does not function properly in Internet Explorer 8

I've tried multiple approaches to transform the IE Matrix, but I'm facing an issue with the transform scale CSS not functioning in IE8. Code: .fture_box ul li.fture_img img{ width: 451px; height: 284px; display: block; margin: 0 0px 0 11px; pad ...