How can I set the width of select box options?

I tried to find a solution through CSS. But I failed to do it. Doesn’t matter; I have written a simple Javascript code for it. This can do something for it. function shortString(selector) { const elements = document.querySelectorAll(selector); const tail=”…”; if (elements && elements.length) { for (const element of elements) { let text = element.innerText; … Read more

Full Width Material-UI Grid not working as it should

I suspect the Container component is causing you problems. Since you haven’t linked its implementation, see below for a working example of what you want. Since Material uses flexbox they make use of property flexGrow The flex-grow CSS property specifies the flex grow factor of a flex item. It specifies what amount of space inside … Read more

Any way to use CSS Variables in SASS functions for hsl() transparency?

Global variables can be defined outside of an element in a :root pseudo-class: :root { –color-primary: #FFFFFF; } you can define a function like this: @function color($color-name) { @return var(–color-#{$color-name}); } and call it into your sass: body { color: color(primary); } compiled sass code is: body { color: var(–color-primary); }

d3.js Map () Auto Fit into Parent Container and Resize with Window

COMPLETE SOLUTION: Here’s the solution which will resize the map AFTER the user has released the edge of the window to resize it, and center it in the parent container. <div id=”mapContainer”></div> function draw(ht) { $(“#mapContainer”).html(“<svg id=’map’ xmlns=”http://www.w3.org/2000/svg” width=”100%” height=”” + ht + “”></svg>”); map = d3.select(“svg”); var width = $(“svg”).parent().width(); var height = ht; … Read more

css 100% width div not taking up full width of parent

The problem is caused by your #grid having a width:1140px. You need to set a min-width:1140px on the body. This will stop the body from getting smaller than the #grid. Remove width:100% as block level elements take up the available width by default. Live example: http://jsfiddle.net/tw16/LX8R3/ html, body{ margin:0; padding:0; min-width: 1140px; /* this is … Read more

Horizontally scrollable list of cards in Bootstrap

Update 2021 Bootstrap 5 The flexbox utils still exist in Bootstrap 5: https://codeply.com/p/Vo13PAGO7e <div class=”container-fluid py-2″> <h2 class=”font-weight-light”>Bootstrap 5 Horizontal Scrolling Cards with Flexbox</h2> <div class=”d-flex flex-row flex-nowrap”> <div class=”card card-body”>Card</div> <div class=”card card-body”>Card</div> <div class=”card card-body”>Card</div> … </div> </div> Update 2019 Bootstrap 4.3+ The flexbox method still works, so you can use the flexbox … Read more

absolute vs relative position width & height

Setting position:absolute removes the element in question from the normal flow of the document structure. So unless you explicitly set a width it won’t know how wide to be. you can explicitly set width:100% if that is the effect you’re after. An element with position:relative on the whole behaves in the same way a normal … Read more

Less: how to write :hover and :focus [closed]

That is the essentially the correct format for nesting, but it is a little unclear what you are expecting. Perhaps you are expecting duplication of the /* some rules */ into the :hover and :focus (just based on what you show above for input and output–if that is not a correct understanding of your issue, … Read more