Looking to expand the width of the b-modal component in a Vue.js application using Bootstrap

Using bootstrap v4 for VueJS, I encountered a challenge with increasing the width of b-modal. Despite trying various solutions mentioned here, nothing seemed to work.

<b-modal :ref="fieldName" :id="fieldName" :title="msg" size="lg" modal-class="b-modal">
    <div class="script_table_container" v-if="scripts.length > 0">
      <b-table :items="scripts" per-page="10" :current-page="currentPage">
        <template slot="propertySnippet" slot-scope="data">
          <samp>
            {{data.value}}
          </samp>
        </template>
      </b-table>
      <b-pagination :total-rows="scripts.length" per-page="10" v-model="currentPage" hide-goto-end-buttons align="right"/>
    </div>

    <div slot="modal-footer">
      <b-btn class="mr-sm-2 su-btn-link" @click="close">Close</b-btn>
    </div>
  </b-modal>

The need arises to increase the width to accommodate long values in the table, aiming for about 80-90% of the screen width.

Your expertise is highly valued and any assistance would be greatly appreciated!

P.S. Solution found! By applying changes to specific b-modals as follows:

I established the following global style:

@media (min-width: 992px) { 
   .modal .modal-huge { 
      max-width: 90% !important;
      width: 90% !important;;
    }
 }

Subsequently, adding 'huge' into the size prop of b-modal enables custom sizing based on the defined CSS class name.

Answer №1

When it comes to modifying elements in your CSS file, creating new ones may not always be the most practical option. It can be time-consuming to constantly search for where you have defined certain styles or properties.

Personally, I prefer including the styling directly within my code. For example, when working with b-model, I came up with the following solution:

<div>
  <b-modal size="xl" title="Very large model"></b-modal>
  <b-modal size="lg" title="Large model"></b-modal>
  <b-modal size="sm" title="Small model"></b-modal>
</div>

This method has proven effective for me using Bootstrap version 4.3.

Answer №2

Following my investigation into the CSS code, I discovered that by implementing the following CSS rules, you can override the existing ones and increase the width:

@media (min-width: 992px)
 .modal-lg {
    max-width: auto !important;
   }

@media (min-width: 576px)
  .modal-dialog {
    max-width: auto !important;

  }

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

Unable to assign a basic HTML class to a Blazor component

Upon attempting to implement the following code in my .NET 5 Blazor project within a .razor file: <SignedLabel class="some-css-class" Price=123 Currency=Currency.Usd /> I encountered an issue where Blazor interpreted the class attribute as ...

When website links are clicked, they receive an unusual border

Encountering issues with CSS on all links. After clicking on a button/link, an unusual border appears (refer to image). Checked all CSS files and did not find any classes associated with this color. View screenshot here ...

Center-align the content in Material UI Typography by using the variant attribute for the caption

I'm struggling to center the content of my Typography elements with default and caption variants using the align="center" property. The alignment doesn't seem to be working properly, especially for the variant as caption. Here is a snip ...

Avoiding the overlap of sub-menu items vertically

My nested unordered list acting as a sub-menu has an issue with overlapping list items. It seems like the padding of the links is causing the overlap: ul { padding: 12px 0; list-style: outside none none; } li { display: inline-block; margin-righ ...

What is the process for determining the default character length in a <p> tag based on its height and width?

I'm trying to determine the default length for the <p> tag in HTML. It should be displayed based on the height and width of the <p> tag. For example: Consider the following code snippet, <p style="height:300px;width:200px;"> </ ...

Issue with Mobile Touch Screen Preventing Vertical Scrolling

Currently experiencing difficulties with a div element that is not allowing touch and vertical scroll on mobile devices. Although scrolling works fine with the mouse wheel or arrow keys, it does not respond to touch. Have tested this on various devices and ...

Preventing Context Menu from Appearing on Long Click in HTML5 Games

I'm attempting to utilize a similar technique as demonstrated in this stackoverflow post: How to disable the 'save image as' popup for smartphones for <input> However, I am encountering an issue where my button is not displaying at ...

I am puzzled as to why this particular contact form is not functioning properly

I'm having trouble figuring out why my form isn't functioning properly. I receive a success message, but nothing is being delivered to my inbox. I even checked my spam folder to no avail. After waiting patiently for a few minutes, still no sign o ...

Conic-Gradient causing an intriguing visual anomaly

When attempting to create a simple conic-gradient using CSS, I've noticed a peculiar horizontal line that keeps appearing. These lines seem unpredictable and sometimes disappear when the window is resized. div { width: 101.5px; height: 10 ...

What is the best way to connect a fresh post to a different URL in ReactJS and Redux?

Currently, I am working with Redux and ReactJS to develop a discussion platform. One of the key features I am trying to implement is where users can input the title and content of their post, which will then be submitted to create a new post. After submit ...

Vuetify: The checkbox displays the opposite status of whether it is checked or unchecked

Can you help me simplify this problem: In my Vue.js template using Vuetify components, there is a checkbox present: <v-checkbox v-model="selected" label="John" value="John" id ="john" @click.native="checkit"> </v-checkbox> ...

Ways to implement pointer event styling within a span element

Hi, I'm having trouble with styling and I can't seem to figure out how to resolve it. The style pointer-events: none doesn't seem to be working for me. Here is an example of my code: The style snippet: .noclick { cursor: default; ...

Struggling to align the div horizontally using text-align?

I need to make the div align horizontally. .d1 { margin-left: 1rem; margin-right: 1rem; font-size: 0; text-align: justify; } .d1::after { content: ''; font-size: 0; line-height: 0; height: 0; width: 100%; di ...

Incorporating text overlays on images that are compatible with responsive websites is a top priority for me

This is a piece of HTML code that utilizes bootstrap 3 for design purposes. The challenge faced is related to positioning text over an image. When resizing the browser, the alignment of the text with the background gets disturbed. Assistance is needed in r ...

Issue with $_SERVER['PHP_SELF'] not functioning properly

Apologies if this question has been asked before, but after searching extensively I couldn't find a solution. Therefore, I am posting here... The issue is that I'm trying to submit values on the same page (using jQuery Mobile UI) and I have used ...

A design featuring two columns and a fixed footer

I'm struggling to make my 2-column layout display properly with a footer that sticks to the bottom of the page. Despite following all the usual advice, my columns keep expanding beyond their container div, which causes the footer to get pushed off the ...

Pulling Specific HTML Element from External Website with PHP

<?php $info = file_get_contents('http://examplewebsite.com/data'); echo $info; ?> I am trying to extract specific information from a remote website using PHP, focusing only on certain tags. While I have found a script that allows me t ...

Child component in Vue 2 not receiving defined props

After numerous attempts, I am still struggling to successfully pass a prop down to a child component. <Project :grossMarginPerResource="grossMarginPerResource" :threshold="threshold" :orderBy="orderBy" @refetch="refetc ...

How can I shift the top line to the bottom of the text using CSS?

I am facing an issue with CSS or HTML where I need to move a line from the first circle to the second one, as shown in the image below. Here is the link to my JSfiddle version: https://i.sstatic.net/Pn6rF.jpg JSFiddle code: https://jsfiddle.net/odzuwsdt ...

What is the best way to reveal and automatically scroll to a hidden div located at the bottom of a webpage?

Whenever the image is clicked, I want to display a hidden div with effects like automatically scrolling down to the bottom This is what my code looks like: $(document).ready(function() { $('#test').click(function() { $(&apos ...