Mastering Bootstrap: Achieving flawless column stacking in succession

I am currently integrating bootstrap into my existing HTML code, but I only require it in two specific sections to avoid rewriting the entire code.

Everything looks fine on my 1080p screen as intended.

However, when I resize the screen slightly

The title appears like this:

Liga
Juizforana

instead of:

Liga Juizforana

(I forgot the technical term for this issue, apologies for my lack of knowledge)

and the trophy image seems a bit misplaced

as I further reduce the screen size

the trophy does not move under the black transparent box containing the description

On a mobile screen:

the trophy overlaps with other elements instead of going below the black box and pushing the background down to fit in its place, resulting in it appearing above everything (the red box).

Here is the HTML code snippet:

<div class='conteudo col-md-offset-1'>

        <div class='inicio'>
        <a id='inicio'></a>
            <div class='topo'>
                <div class='subir col-lg-6 col-lg-offset-1'>
                <div>
                <p class='titulo'>Liga Juizforana</p>

                <hr size='1' align='left'>

                <p class='subtit'>A Liga Juizforana tem o intuito de trazer campeonatos diversos para a cidade focando em League of Legends. A intenção do campeonato é a diversão de todos, tendo campeonatos sempre que possível para todos se interagirem, conhecerem e entrarem no cenário competitivo da cidade.</p>
                </div>
                </div>


                <div class='grandelogo col-lg-5 col-lg-offset-7'>
                    <img src='imagens/LigaJFLogo.png' border='0px' alt='LigaJFLogo' title='LigaJFLogo'>
                </div>
            </div>

            <div class='textos'>
                <p id='intro'>A Liga Juizforana tem o intuito de trazer campeonatos diversos para a área da cidade começando por League of Legends. A intenção do campeonato é o foco na diversão de todos, tendo campeonatos sempre que possível para todos entrarem no cenário competitivo da cidade.<br><br>

                Dessa vez é a terceira edição :D. Inicialmente o campeonato vai ser focado em ter 16 times no total, e conseguimos recompensa da própria Riot! Inicialmente o campeonato será online mas caso cresçamos o campeonato pode ter etapas offline, e caso você queira ajudar com isso, pode mandar uma mensagem pelo próprio sistema de contato pelo site.</p>

                <div class='logoLol'>
                    <img src='imagens/lolLogo.png' border='0px' alt='lolLogo' title='lolLogo'>
                </div>
.
.
.

I have attempted to organize all these classes to better understand their purpose and prevent any potential conflicts or bugs caused by using similarly named elements.

Regarding the CSS styling:

.conteudo {
    }

.conteudo .topo {
    height: 952px;
    background-image: url("http://na.leagueoflegends.com/sites/default/files/upload/art/wp_alistar_vs_olaf_1920x1080.jpg");
    background-color: #ffffff;
}

.topo .titulo {
    max-width: 85%;
    font-size: 74px;
    color: white;
    text-shadow: 5px 5px 1px rgba(0, 0, 0, 1);
}

.topo hr {
}

.subir{
    padding-top: 250px;

}

.topo .subtit {
    margin-left: 80px;
    font-size: 18px;
    color: white;
    text-shadow: 2px 2px 1px rgba(1, 0, 0, 1);
}


.subir div {    
    background-color: rgba(0, 0, 0, 0.6);
    padding-left: 50px;
    padding-top: 50px;
    padding-right: 50px;
    padding-bottom: 50px;
}


.grandelogo {
    margin-top: -34%;
}

I am struggling with making the design responsive and would greatly appreciate any assistance or tips. I know this is quite a complex issue, but if you could provide some guidance or suggestions that would be extremely helpful. I have provided multiple screen examples to help illustrate the problem clearly.

Answer №1

To optimize your HTML structure, consider incorporating some default bootstrap classes.

Essentially, you should organize your code using a mix of rows and columns.

In your scenario, there are two sizable content blocks (the transparent black block and the trophy image).

These blocks should be enclosed within a single row but placed in separate columns. Here's an example:

<div class="row">
    <div class="col-xs-12 col-md-6">Liga Juizforana Block</div>
    <div class="col-xs-12 col-md-6">Trophy Block</div>
</div>

Any additional content associated with these blocks should be placed in separate <div class="row"> elements.

You could even adjust your entire markup so the whole page is encompassed in one row, with the left side navigation in one column and the main content in another column.

<div class="row">
    <div class="col-xs-12 col-md-2">
        Left-Side Nav
    </div>
    <div class="col-xs-12 col-md-10">
        <div class="row large-background">
            <div class="col-xs-12 col-md-6">Liga Juizforana Block</div>
            <div class="col-xs-12 col-md-6">Trophy Block</div>
        </div>
    </div>
</div>

Apply the desired background to the inner row (or the parent column class) and ensure it appears correctly on mobile devices. It's often easier to start with mobile markup and then adjust for desktop views.

Refer to the Bootstrap documentation on grids (http://getbootstrap.com/css/#grid) for more examples and detailed information.

Answer №2

To ensure a responsive design using Bootstrap, the key is to prioritize mobile first. For example, if you want a column to occupy the full width on small screens, half width on medium screens, and 1/4 width on large screens, you must specify it as follows:

<div class="col-xs-12 col-md-6 col-lg-3">

If you encounter issues with text wrapping, consider using media queries to adjust the font size based on screen size:

@media (min-width: 320px) {
  .title {
    font-size: 1em;
  }

}

@media (min-width: 700px) {
  .title {
    font-size: 3em;
  }
}

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

Tips for customizing text color in a disabled MUI TextField?

In the disabled TextField, I want the text color to be black instead of the default gray. I attempted the following after finding inspiration from this source: <TextField id="outlined-basic" value={'https://git.responsive.software/my-app ...

Shifting the "active" designation within a dropdown menu to correspond with the user's current page

Recently, I decided to explore the Foundation framework. However, my first stumbling block was figuring out how to use the "active" class in a dropdown menu. I am hoping to have the class applied to the page link that is currently being viewed by the user ...

While scrolling, the menu is being truncated

When I scroll down the page, the top menu is being partially hidden. Take a look here for reference. I want to maintain a consistent width for the header at all times. ...

Using CSS within the HTML code is effective, however, linking to an external CSS file is not working

I require assistance. This situation is absolutely absurd. Currently, I am utilizing Komodo IDE version 7.1.2 and Firefox version 15.0.1. The HTML5 file that I created looks like this: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" ...

Error alert: The system could not locate Google when trying to drop pins

Every time I attempt to place pins on the map, I encounter the "google is not defined" error. The map itself displays without any issues until I add the lines following the initMap() function. I have come across similar posts but none of the suggested so ...

Issues are arising with CSS .not(selector) functionality when applied to a span element

One of the challenges I'm facing is formatting a header with a span tag that contains a date and some accompanying text. The goal is to make the text bold without affecting the formatting of the date. In my CSS file, I have tried using :not(cls) to t ...

Using HTML and CSS to Position Text Within an Image

Is there a way to position an image next to specific points on the screen so that it remains in the same place regardless of screen size? Here is what I am trying to achieve: https://i.stack.imgur.com/A5cop.png Using HTML, this is my desired setup: < ...

What are some effective methods for maintaining the integrity of HTML content?

Attempting to safeguard HTML content generated in a specific location by powerMTA. Here is the code snippet of the HTML content. Content-1. <html>=0A<body>=0A<table style=3D"max-width:576px;font-family:Arial, Helvet= ica, sans-serif;&q ...

Cannot close the Bootstrap dropdown after selecting an option

I am encountering an issue with a dropdown list that has a select feature using Bootstrap 3.4.1. The problem is that the dropdown remains open after selection and does not close unless I click outside of the list. Here is the HTML code: <div id="c ...

What is the best way to align the logo image in the center of the header vertically?

I am trying to vertically center my logo, but I have not been successful with using margin: auto or margin: center. Here is what I have tried so far: ・text-align: center; ・margin: auto; ・margin: center: ・navbar-brand-center The logo currently app ...

Unable to get the desired 100px margin at the bottom

Can someone assist me in positioning the right side image at the bottom of the div tag using CSS? I have tried using the .up class in my style tag but with no success. How can I achieve this by adjusting the margin? <!DOCTYPE html> <html lang=" ...

Does activating a hyperlink on an anchor element count as a cross-origin request?

Understanding CORS: Cross-origin resource sharing (CORS) is a method that enables limited resources on a webpage to be requested from a different domain than the one where the initial resource originated. Let's say I have a simple HTML page with a li ...

Challenges encountered while making CSS adjustments on the Wordpress Twentyfourteen theme

I'm currently assisting a friend with making some final adjustments to their website. The site is built on Wordpress using the Twentyfourteen theme and can be found at centromariposa.no. Most of the modifications have been completed, but I'm fac ...

Displaying genuine HTML content in a React application using Algolia Instantsearch

After setting up a demo app using React with an Algolia search feature, I uploaded some indices into Algolia. The content consists of raw HTML. Is there a way to display this content as real HTML using Algolia? ...

Using Regular expressions in JavaScript to eliminate content between two HTML comment tags

I am currently dealing with two HTML comments in this format: <!--Delete--> Blah blah blah blah <!--Delete--> I need to remove these comments, along with any characters and newlines. I am utilizing JavaScript and Grunt for this replacement ta ...

How to prevent click events and still enable scrolling within a DIV using CSS/JS

Basically, I am looking to enable scrolling within a DIV while also disabling click events. Any suggestions on how this can be achieved? Appreciate any help! ...

Switch classes according to scrolling levels

My webpage consists of multiple sections, each occupying the full height and width of the screen and containing an image. As visitors scroll through the page, the image in the current section comes into view while the image in the previous section disappe ...

Effortlessly browse through directory with the seamless integration of AngularJS or

Hey there! I'm working on a really cool feature - creating a list with editable inputs. However, I've encountered a bit of an issue. Is there any way to navigate through this list using arrow keys and focus on the desired input? .content ul { ...

Disabling a button until a selection is made in a combobox using Angular

I am currently working on a template that includes a combobox, a button, and a table. What I am trying to achieve is to make the buttons unclickable unless a value is selected from the combobox. After selecting a value, the button will call a service metho ...

The lack of flexibility in this element stems from the fact that it is not classified as a flex item

I'm facing an issue with flexbox and its unusual behavior. I have set up flexbox for the parent element and used flex: 1 1 100%, but it's not working as expected. When I checked in Firefox Developer Tools, it says that the parent is not a flex co ...