Adjust the font size to fit the size of the button when resizing a md-button

Currently utilizing md-button with text inside

An issue arises in low resolution where the text gets cut off, struggling to find a suitable solution

If anyone has any suggestions on how to resolve this problem, please share.

I have included screenshots in both high and low resolutions as well as the corresponding css and html code

<md-dialog id="new_test_draft_dialog" flex=40 flex-md=50 flex-sm=60 flex-xs=80>
    <div>
        <div layout-padding>
            <h2>Save Changes?</h2>
            <div style="padding:5px;" layout-padding>
                <div layout="row" layout-align="center center">
                    <md-button ng-click="draftDialogService.cancel()" class="button_type_1 active">Continue</md-button>
                    <md-button ng-click="draftDialogService.hide()" class="button_type_1 active">Discard</md-button>
                    <md-button ng-click="draftDialogService.hide(saveDraft())" class="button_type_1 active">Save draft</md-button>
                </div>
            </div>
        </div>
    </div>
</md-dialog>

The css:

/* Buttons */
.button_type.md-button,
.button_type,
.button_type_1 {
    border: 3px solid #fff;
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    border-radius: 10px;
    -moz-background-clip: padding;
    -webkit-background-clip: padding-box;
    background-clip: padding-box;
    padding: 5px 5px;
    color: #fff;
    display: inline-block;
    text-decoration: none;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
    word-wrap: break-word;
}

https://i.sstatic.net/3P6No.png https://i.sstatic.net/JrwSh.png

Answer №1

If you're looking for a different approach to your issue, check out this solution on CodePen

This method focuses on adjusting button layout based on screen size for a responsive design. It aligns with the Angular Material principles.

Sample Code

<div ng-controller="AppCtrl" ng-cloak="" ng-app="MyApp">
  <div layout-gt-xs="row" layout-xs="column" layout-align="center center">
    <md-button class="md-raised md-primary">Continue Adding</md-button>
    <md-button class="md-raised md-primary">Discard Changes</md-button>
    <md-button class="md-raised md-primary">Save Draft And Exit</md-button>
  </div>
</div>

Learn more about Angular Material Layout here

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

Hiding a div using swipe gestures in Angular

What am I trying to achieve? I aim to hide a div when swiped right. This specific action will close the pop-up that appears after clicking a button. What tools are at my disposal? I am utilizing Ionic framework for this task. Within my app.js, I have i ...

Angular JS has a unique feature of a scrollable drop-up menu that allows

https://i.sstatic.net/MOUqO.pngHere is the code snippet for my Dropup component: <div class="dropup"> <button class="btn btn-primary btn-raised dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false> ...

Encountering an issue with the factory test within the controller, as it indicates that

Seeking assistance with testing the function below within a controller. getEmployeeList is a function within the controller that loads data in the UI upon controller initialization. It relies on a factory, but after implementing the code snippet below in ...

Is it feasible to incorporate the CSS and Bootstrap (CDNs) specific to an HTML component without affecting the styling of other pages?

One way I am able to recycle the HTML component is using this code: $.get("nav.html", function(data) { $("#fulloptions").replaceWith(data) }) However, there’s a conflict because nav.html uses a different version of Bootstrap than my index file does ...

Concealing a CSS class with PHP within the Wordpress Woocommerce platform

I have very limited knowledge in programming and need help with a code snippet. I am using the Wordpress Snippets Plugin to hide the Add Cart Button from a single product. add_action( 'wp', 'rudr_remove_add_to_cart_single_product' ); fu ...

Excessive whitespace bordering the perimeter of the webpage

I've recently delved into the world of HTML/CSS and I'm working on creating a simple website. However, I'm encountering some white space-related issues above the header/body and around the sides. Despite trying various adjustments with margi ...

Preserve user-inputted text from jQuery within a div container

With the help of the knowledgeable individuals here, I successfully created a prototype to address an issue I had encountered. The problem involved using a textbox input with a password requirement to update an HTML element. Although everything is functio ...

Serialize a series of select boxes to optimize for AJAX POST requests

To better explain my issue, let's consider a simple example: Imagine I have a form that collects information about a user: <form action="#" method="post" id="myform"> <input type="text" name="fname" /> <input type="text" name= ...

Event follows activation of trigger click

I've already gone through this post on Stack Overflow about triggering an action after a click event, but none of the solutions I've tried so far have worked. Let's say I have a menu on my webpage like this: <ul class="nav nav-tabs"&g ...

Ways to achieve text transparency with CSS without converting it to an image

Is there a way to have my navigation bar indicate the selected page by changing the text color and adding a black background, while making only the text inside the current page nav transparent? For example, you can see the effect here: sammarchant.co.uk/n ...

Please input only 0s and 1s into the designated field

How can I modify this code to only accept 0 and 1 in the input field, while also adding spaces after every 4 digits? Currently, it accepts all digits. I'm struggling with creating a pattern that restricts it to just 0 and 1. document.getElementById(&a ...

Transferring Specific Information to Individual Fancybox Instances

I'm currently in the process of integrating Fancybox 3 into my application. My goal is to create a custom button that performs specific functions for each instance, requiring additional data such as photoId and settingsId. To illustrate: HTML: Withi ...

What is the method for automatically verifying elements within nested ng-repeats?

My div contains ng-repeat elements that are interconnected. Each ng-repeat element has checkboxes, and I want to automatically check the related elements in other ng-repeats when a top ng-repeat element is checked. Here is the actual representation of the ...

Functions perfectly on Chrome, however, encountering issues on Internet Explorer

Why does the Navigation Bar work in Chrome but not in Internet Explorer? Any insights on this issue? The code functions properly in both Internet Explorer and Chrome when tested locally, but fails to load when inserted into my online website editor. Here ...

Troubleshooting Angular2 Error: Incompatibility with TypeScript - Unable to Assign String

While working on creating a custom pipe in Angular2 for filtering, I encountered the following build error: Error TS2322: Build: Type '() => string' is not assignable to type 'string' Below is my sample code: import { PipeTransf ...

The custom switch input with a blue outline is reluctant to vanish

Hey there! I'm currently using Bootstrap and I'm facing an issue with removing the blue outline around a custom switch button when clicked. I've tried to remove it using CSS but it doesn't seem to work, especially in Chrome. Here's ...

Crafting a unique datalist from an XML file with the help of jQuery

<mjesta> <mjesto>Zagreb</mjesto> <mjesto>Split</mjesto> <mjesto>Ploce</mjesto> <mjesto>Pula</mjesto> <mjesto>Pazin</mjesto> <mjesto>Daruvar</mjesto> <mjesto>Bjelovar</mj ...

Unable to install @uirouter/angularjs using npm

Encountering an error while trying to npm install @uirouter/angularjs, the error message displayed is: npm ERR! code E404 npm ERR! 404 Not Found: @uirouter/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="96f7f8f1e3faf7e4bfb9f8d ...

The use of the `foreach` loop

How can I change the position index to start at 1 instead of 0? I want the first name to be listed as number 1 and end at number 50. Is there a way to fix this issue? Here is my code: <html> <head> <title>SEATPLAN</title> &l ...

Is it possible to convert a blob to an image file using the FileReader in HTML

client side code <head> <script> var reader = new FileReader(); var objVal; var image = new Image(); reader.onload = function(e) { document.getElementById('propertyImg').setAttribute('src', e.target.result); }; fun ...