Utilizing Bootstrap for Inline-block 'Button' Categories

I have been pondering whether it is possible to create a row of blocks that never stack on top of each other and adjust line-height so that text always stays centered in those blocks, regardless of the amount of content (and when necessary, adjusting the block heights themselves). I am envisioning something similar to the code snippet below:

ul
{
  padding: 0;
  margin: 0;
}

li
{
  float: left;
  list-style-type: none;
}

li a
{
  display: block;
  height: 60px;
  width: 60px;
  background-color: #009ec3;
  color: white;
  margin: 0 2px 2px 0;
  line-height: 60px;
  text-align: center;
}

li a:hover
{
  color: white;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<ul>
  <li>
    <a href="#">Item 1</a>
  </li>
  <li>
    <a href="#">Item 2</a>
  </li>
  <li>
    <a href="#">Item 3</a>
  </li>
  <li>
    <a href="#">Item 4</a>
  </li>
  <li>
    <a href="#">Item 5</a>
  </li>
  <li>
    <a href="#">Item 6</a>
  </li>
  <li>
    <a href="#">Item 7</a>
  </li>
  <li>
    <a href="#">Item 8</a>
  </li>
  <li>
    <a href="#">Item 9</a>
  </li>
  <li>
    <a href="#">Item 10</a>
  </li>
  <li>
    <a href="#">Item 11</a>
  </li>
  <li>
    <a href="#">Item 12</a>
  </li>
  <li>
    <a href="#">Item 13</a>
  </li>
</ul>

I attempted using Bootstrap's .col-md-1 class but it only supports up to 12 blocks and I need at least 13 or more. Is there a way to accomplish this in Bootstrap and if so, how would I go about doing it?

JSFiddle

Edit: I am striving to center the text within the category buttons and initially the previous stylesheet utilized the flexbox property for this purpose (since line-height does not work well for multiple lines of text). The challenge with flexbox is that it lacks compatibility with older browser versions, including IE9. Can anyone advise on how to resolve this issue within the following code referenced in this JSFiddle?

Answer №1

If you want to enhance user interaction on your website, consider using swiper js for a more dynamic experience where items can be freely draggable.

Explore Swiper.Js here

var swiper = new Swiper('.swiper-container', {
    slidesPerView: 'auto',
    freeMode: true,
    nextButton: '.swiper-button-next',
    prevButton: '.swiper-button-prev',
});

Take a look at the fiddle and try dragging the items around.

Interactive demo link here

Answer №2

Consider using percentages instead of pixels for more flexibility in your layout design. If you need to incorporate additional columns in Bootstrap's grid system, visit the customization page and adjust the @grid-columns: setting.

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

Assess the scss styles specific to components following the global min.css in a React application

ISSUE Imagine we have a min.css file that needs to be imported globally: index.js import ReactDOM from "react-dom"; import App from "src/App"; import "library/library.min.css"; ReactDOM.render(<App />, document.getE ...

problem with placing text into input field

When using my search program, I am encountering an issue where there is some added space before the text once it is set into the input box after clicking on a search result. To see the problem in action, you can visit the following link: http://jsfiddle. ...

Tips on managing scrollbar behavior in Angular UI Grid

In my current project, I am utilizing Angular UI Grid. The grid automatically resizes itself so that all columns fit within a specific div horizontally. While this feature works well initially, it becomes problematic when there are more rows than can fit ...

Adjusting the z-index of the tinyMCE toolbar

I have been utilizing the tinyMCE editor plugin, which transforms textareas into iframes and displays a toolbar at the top of the content. It has been functioning flawlessly. However, there are times when there are videos placed above the content. In such ...

Does the input password typically submit on its own?

When attempting to create a form, I encountered an unexpected behavior. <form> <input type="text" autocomplete="username" style="display:none;"> <label for="password">password:</label><input type="password" autocomplete="c ...

Animate the sliding of divs using the JavaScript animation function

I've designed some boxes that function similar to notifications, but now I want to smoothly slide them in from the left instead of just fading in. I know that I need to use .animate rather than .fadeIn to achieve this effect. The code snippet I&apos ...

"Can anyone tell me why my index.html file isn't recognizing the style.css file located in my css directory

In the directory structure below, I have the following files: mywebsite/ ├── css/ │ ├── style.css │ ├── index.html This is my HTML code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8 ...

What is the correct way to implement checkbox validations using jQuery?

I have a total of 3 checkboxes that I would like to arrange in a particular order based on their checks. Currently, when one checkbox is selected for download, the logic I have implemented only considers the first checkbox and ignores the rest. I am look ...

Creating a responsive textbox in Bootstrap - tips and tricks!

I am trying to use Bootstrap and I have a Textbox that contains some text. How can I make it responsive, meaning it adjusts to the screen size when I resize the window? When dealing with images, we use the "image-responsive" class, but what about a Textb ...

The input and label are not experiencing any overflow

I've been following a tutorial to create an animation on an input and label. I successfully did it once today in school, but for some reason, it's not working now. My objective is to have the label inside the "input" field, with the input taking ...

Resizing the window causes divs to be positioned relative to the image (almost functional)

In my coding project, I've encountered a situation where I have 3 "pins" positioned within a div called #outerdiv. This div has a background-image and the pins are supposed to remain in the same spot on the background image no matter how the window is ...

Troubleshooting Bootstrap 4: hidden-md-up inconsistency

I'm trying to hide these menu bars with the class hidden-md-up, but it's not working. I'm using CDN but i've also tried the files and checked the class...can anyone help? Here's what I have <div class="col hidden-md-up"> ...

Is there a way to determine if a property can be animated using CSS3 transitions?

Inconsistencies in the list of properties that can be animated with a CSS3 transition exist among browsers and are subject to change with new browser versions. For instance, -moz-transform is not animatable with -moz-transition in FF3.6 but it is in FF4. ...

Discovering elements in selenium can be achieved through various techniques such as

I am trying to locate the element "Holiday4" within the span class="fc-title". Should I use a CSS selector or an XPath query for this task? <tr> <td class="fc-day-number fc-sun fc-future hp-cal-selected" data-date="2016-02-14">14</td ...

Increase the size of the embedded iframe in your Cordova application by using the pinch-to-zoom

I have been struggling with this issue for the past few days and am having trouble finding a solution.. I am trying to figure out how to embed an iframe in a cordova app (running on an iOS device) to display an external webpage while allowing users to pin ...

Closing the dropdown menu by directly clicking on the button

I've noticed several inquiries on this platform regarding how to close a drop-down menu by clicking anywhere outside of it. However, my question is a bit different. I want the dropdown-menu to remain open once clicked, only closing when the user clic ...

Issues with CSS selectors in Internet Explorer causing problems with Selenium Webdriver C#

When automating a website with Selenium C#, I encountered a NoSuchElementException when trying to click an element using a CSS selector. However, the issue was resolved when using xpath instead. Can someone shed light on why this discrepancy between CSS an ...

CSS Column Height not Transferring to Descendants

Trying to transform this... http://jsfiddle.net/K2NPz/1/ Into this... The image on the left is current, while the one on the right is the desired outcome. However, I'm facing challenges making it work as intended due to issues with the inherit prope ...

What is the best way to achieve this smooth scrolling animation on the page?

While browsing the website , I noticed a unique page scrolling effect that caught my eye. Unsure if they were using default bootstrap code or their own custom code, I was intrigued by how it worked. I attempted to find similar effects online but struggled ...

Applying CSS width to cloned HTML code using the .html() method does not have any effect

In my setup, there is a concealed div that contains a form with the CSS property display set to none. Utilizing jsPanel (a jQuery plugin), I create modal popups within my window. When the modal pops up, I use .html() to copy the contents of the hidden div ...