Struggling to vertically align text beside an image in Twitter Bootstrap - any suggestions?

I'm currently incorporating Twitter Bootstrap and facing a challenge with centering text vertically next to an image that exceeds the size of the text.

The use of line-height is not feasible as the text spans multiple lines and may be subject to additions; hence, I attempted the

display: table; display: table-cell;
approach which unfortunately did not yield the desired outcome.

Below is my HTML markup for the specified section:

<div class="fs">
    <div class="container">
        <div class="wrapper row">
            <div class="icon col-md-2">
                <a href="" target="blank">
                    <img src="fs-icon.jpg" width="170" height="76" alt="Flying Solo Icon">
                </a>
            </div>
            <div class="text col-md-10">
                <span>
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam tincidunt, lacus sed pharetra luctus, odio purus faucibus nunc, mattis molestie sapien libero sit amet leo.
                </span>
            </div>
        </div>
    </div>
    <!-- Container Ends -->
</div>
<!-- FS Ends -->

CSS:

#about .fs {
    padding: 30px 0;
}

#about .fs .wrapper {
    display: table;
}

#about .fs .icon {
    display: table-cell;
}

#about .fs .text {
    display: table-cell;
    min-height: 76px;
    vertical-align: middle;
}

... check out the live example on CodePen: http://codepen.io/anon/pen/XbdRXE

Answer №1

It seems like there may be a conflict between the CSS styles and the default Bootstrap styles causing the issue. One way to solve this is by creating a custom class like so:

.vertical-center {
    display: inline-block;
    vertical-align: middle;
    float: none;
}

You can then apply this custom class to your span element.

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

Horizontally align the list items within a div that has overflow:auto

Currently, I am working on a timeline project and have the following code: $("#time-line-selector ul li a").click(function(event) { event.preventDefault(); $("#time-line-selector ul li a").removeClass("active"); ...

Is there a method for converting HTML/CSS into an image file?

My issue involves an unordered list (<ul>) with styled list items (<li>) that may have their properties changed through CSS manipulation (such as adding a different background on click using jQuery). I am currently using the TCPDF library to g ...

Creating sequential hover animations with CSS in HTML

I have a total of four divs that I want to hover continuously, one after the other. Here is the code I am currently using: #rij1 .content-overlayz, #rij1 .content-details { animation-duration: 2s; animation-name: stepped-pulse; animation-iterati ...

What is the best way to decrease the width of one of the four columns?

I trust all is well with you. I'm having trouble adjusting the width of one of my table data cells. In the image attached below, you'll notice that my + icon is the same size as the other columns. I'd like to make it much narrower and posit ...

Resolving Discrepancies in SVG Rendering on MacOS between iOS and Chrome

I am trying to create a title that adjusts its size based on the screen width without breaking into multiple lines. I am currently using an SVG technique to achieve this effect. Here is the code snippet: <!DOCTYPE html> <html lang="en"> <h ...

Attempting to enlarge logo or image when cursor hovers over it

Seeking to enhance logo/image size when cursor hovers over it, but facing an issue where it enlarges even on areas outside of the image itself - View Example. I followed a tutorial to achieve this effect, and specified the width as 1024x1024 for the logo/i ...

What is the best way to include the border-radius CSS property to a dropdown element in Ant Design?

Adding the border-radius CSS property to my dropdown component from ant design has been a bit challenging for me. I attempted to modify the antd-css file and include a style object directly into the component, but unfortunately, I did not achieve the des ...

The HTML pattern [A-Za-z] specifies that the entered name must adhere to the required format, such as inputting "john"

<div class="title details"> <label for="idtitle" class="label">Title</label> <input type="text" placeholder="Title" id="idtitle" pattern="[A-Za-z]" required> </div> Link to Firefox screenshot ...

Tips for enabling the wrap property with autogeneratecolumn set to true

In my grid view, I want to ensure that any text in a column that exceeds the width of the column will either wrap within the column or display on a new line. Below is the code for the grid view: <asp:GridView ID="GridView1" AllowSorting="True" runa ...

What is the simplest way to shift an icon to the right in the header of an Expansion panel using Vuetify

After implementing the template from this example: https://vuetifyjs.com/en/components/expansion-panels/#usage I am facing an issue where the header icon is stuck to the title Even applying "float: right;" does not seem to resolve it Has anyone els ...

When I adjust the page size, the navbar stays hidden after clicking

Trying to implement a toggle button for the navigation bar. The objective is to hide the navbar on screens smaller than 667px and display a toggle button instead. Clicking the button should toggle the visibility of the navbar items. The toggle button work ...

Printing pages with Bootstrap without disrupting cards

My goal is to print a basic bootstrap page using window.print(). Here is what the page looks like (with multiple div.col-md-12 & cards) : <div class="overview"> <!-- Takes up entire screen width --> <div class="row"> <div ...

The fixed div width suddenly switches to 100% without warning

I'm struggling with a basic design issue. My goal is to align the purple div next to the yellow div. Both of these divs are nested inside the white div, and the white div is enclosed within the blue div. When I float the yellow and purple divs to the ...

Tips for customizing the appearance of a Horizontal Splitter panel in GWT version 1.5

I need to customize the style of the right side of a horizontal splitter panel. While GWT 1.7 offers support for individual panel styles, our project is currently on GWT 1.5. Here is the GWT code snippet: HTML div1 = new HTML("Div 1"); div1.setWidth("200 ...

What is the best way to ensure that multiple bootstrap buttons in a row have the same width?

Could you help me figure out how to make the <div id="full"> element take up the full width of its parent container, while also ensuring that the 3 buttons inside share this width and have equal sizes with gaps between them? https://i.stac ...

`Is there a way to hide inline text on small screens using Boostrap 4?`

Within this specific scenario, my goal is to conceal the text when viewed on smaller screens and solely display the icon located to the left (an icon representing comments from font awesome): <a id="newCommentLink" href="#"> & ...

Stylish CSS3: Skeleton Silhouette

Is there a way to create a grid with a dog bone shape using CSS and/or jQuery? The unique bone format consists of: The grid should have a similar appearance, but instead of being hexagonal it should be in the shape of a dog bone, with the content (ima ...

Steps to make a dropdown menu that showcases all files within a folder using HTML5 and Javascript

I am attempting to implement a dropdown menu that displays all the files currently in a directory. The goal is for the user to be able to click on a file in the list and have the name of that file printed to the console. Here is my current progress: HTML ...

Is it possible to create a responsive Material UI tab design?

How can I make the Material UI tab react component responsive? Check out the documentation for MATERIAL UI TAB here If I have multiple tab items with a search bar like shown below, how can I ensure that the input component stretches the whole width of th ...