Issues with the functionality of Bootstrap

Upon loading the page, I am encountering an issue with a collapse on the 'main' id. It fails to collapse initially and only functions correctly after being clicked. I have not utilized 'collapse in', so I am unsure why this behavior persists.

Additionally, when I click on the header, the container expands but then readjusts awkwardly. I would appreciate it if you could review the code provided to help me address these concerns.

Furthermore, my attempt at creating two columns in the header row seems to be failing. The divs are not aligning properly as the one with col-xs-2 is shifting to the bottom of the other column instead of appearing side by side. The same issue applies to the two buttons in the 'main' section. Your assistance in resolving these matters would be greatly appreciated.

<!DOCTYPE html>
<html>
<head>
<title>XYZ</title>
<link rel="stylesheet" href="custom-style.css">
<link rel="stylesheet" href="bootstrap.min.css">
<script src ="jquery-3.0.1.min.js"></script>
<script src ="bootstrap.bundle.min.js"></script>
</head>
<body>


         <div class="container" id="container">
                <div class="row" id="header">

                    <div class="col-xs-10" id="logo" data-toggle="collapse" data-target="#main">XYZ</div>

                    <div class="col-xs-2" id="arrow-down">Arrow</div>            

               </div>

               <div class="row" class="collapse" id="main">
                    <div class="col-xs-12">
                        <div class="row">
                            <div class="col-xs-6" id="button1">
                                <button type="button" class="btn btn-primary active">Detail1</button>
                            </div>
                            <div class="col-xs-6" id="button2">
                                <button type="button" class="btn btn-primary disabled">Detail2</button>

                            </div>
                        </div>
               </div>

               </div>

        </div>


</body>
</html>

CSS styles:

*{
        margin: 0;
        padding: 0;
    }
#container{
    width:450px;
    border: 1px solid black;
    height: auto;

}

#header{
    background-color: #6C6D70;
    border-bottom: 5px solid #2DB5AB;
    height: 50px;
}

#logo{

    padding:10px;
    font-size: 18px;
    font-family: sans-serif;
    font-weight: bold;
    color: #FFFFFF;
}

#arrow-down{

    color:black;
    font-size: 18px;
    padding: 15px 10px 10px 10px;

    border: 1px;
}

#main{
    padding: 10px;
}

#video-detail{


}

#buttons{

    padding:10px;
    margin: 0 auto;
    border: 1px solid black;
}

Answer №1

Make sure to include the CSS class "collapse" on the #main element

<div class="row collapse" class="collapsed" id="main">

Check out the code on Jsfiddle: http://jsfiddle.net/yru9hf7t/

Answer №2

I believe this information will be beneficial

HTML Code Snippet

<div class="container" id="container">
    <div class="row" id="header">
        <div class="col-xs-10" id="logo" data-toggle="collapse" data-target="#main">ABC</div>
        <div class="col-xs-2" id="arrow-down">Arrow</div>
    </div>
    <div class="row collapse" class="collapsed" id="main">
        <div class="col-xs-12">
            <div class="row mystyle">
                <div class="col-xs-6" id="button1">
                    <button type="button" class="btn btn-primary active">Detail1</button>
                </div>
                <div class="col-xs-6" id="button2">
                    <button type="button" class="btn btn-primary disabled">Detail2</button>
                </div>
            </div>
        </div>
    </div>
</div>

CSS Styles

* {
    margin: 0;
    padding: 0;
}
#container {
    width:450px;
    border: 1px solid black;
    height: auto;
}
#header {
    background-color: #6C6D70;
    border-bottom: 5px solid #2DB5AB;
    height: 50px;
}
#logo {
    padding:10px;
    font-size: 18px;
    font-family: sans-serif;
    font-weight: bold;
    color: #FFFFFF;
}
#arrow-down {
    color:black;
    font-size: 18px;
    padding: 15px 10px 10px 10px;
    border: 1px;
}
.mystyle{
    padding:20px;
}
#buttons {
    padding:10px;
    margin: 0 auto;
    border: 1px solid black;
}

View working fiddle:http://jsfiddle.net/iamraviteja/ryqgm0ra/

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

What impact does the text-shadow property have on altering the color of hsla text?

I created a header that changes color to be slightly transparent with a black outline when hovered over (achieved using 4 text-shadows). However, I encountered an issue when trying to use hsla() to define the color. The color defaults to black with 100% o ...

An effective method for targeting a specific button within a CSS file

I have multiple button tags in my code, but I need to style a specific one using CSS. How can I target this particular button and apply styles only to it while leaving the others unchanged? Do I need to assign the button to a variable and reference that va ...

Stop material button from animating when clicked

On my webpage, I have created a unique button structure using Angular Material design: <button mat-button class="library-tile-button"> <button mat-button class="edit-library-button"> <img class="edit-library-img" src="..."/> ...

What is the best way to eliminate the lower margin in the UI-Boostrap Angular Tab directive?

The ui.bootstrap.tabs directive, which can be found here, seems to have a default margin before displaying its content. https://i.stack.imgur.com/NECGA.png Here is the HTML snippet: <uib-tabset active="activeJustified" justified="false" id="tabSet" s ...

Unfortunately, CSS3 PIE is not compatible with border-radius and box-shadow properties

I created a basic HTML/CSS code for testing purposes, but I'm having trouble getting the library to function properly. I've placed the .htc, .php and .js files in the same directory as index.html, but it just won't work. Check out the code ...

Sketch a line extending from one element to the next

Is there a way to create a styled line that starts from the center of one <td> element and ends at the center of another? I attempted to use the jQuery Connections plugin but it only connects the edges of the elements, not their centers. The plugin ...

Unable to alter the dimensions of the `symbol` element from an external SVG using CSS, although the other `symbol` within the same document is responsive to styling changes

Could someone help me find the bug in my code related to resizing SVG symbols with CSS? I am able to resize one <symbol> from an external SVG file, but not another <symbol> from the same file. In my CSS, I am trying to change the width and hei ...

The flash movie covers part of the menu that is relatively positioned

While designing a website, I encountered an issue with the Flash slider (CU3ER) overlapping the menu bar. Despite trying various z-index configurations to ensure the drop-down menu stays on top, none of them seem to work. Initially, the drop-down menu rem ...

Break up a list into separate paragraphs and style each word using individual CSS

I have a user-generated paragraph that consists of a list of words separated by commas, such as "dog, cat, hamster, turtle." I want to be able to individually assign attributes to each word in the list. Check out this image for reference In the example i ...

Place items at the lower part of the container rather than the top

My <ul> has a fixed height and I want the <li> elements inside it to stack at the bottom instead of the top. I attempted using vertical-align: bottom on the <ul>, but that didn't have any effect. The <li> content may overflow ...

What techniques can I implement using JavaScript or CSS to create a slightly transparent effect on my text?

I am currently developing a website that features changing background images. I am looking to have the text on the site mimic the color of the backgrounds, but not so much that it becomes difficult to read. How can I make the text transparent in this man ...

Looking for a JavaScript code to create a text link that says "submit"?

Here is the code I have, where I want to utilize a hyperlink to submit my form: <form name="form_signup" id="form_signup" method="post" action="/" enctype="multipart/form-data"> ... <input type="submit" value="Go to Step 2" name="completed" /> ...

Struggling to get JavaScript to successfully load a .txt file in order to load various links

I created a cool feature that takes users to a random link, but I currently have a large list of links and wanted to find a way for JavaScript to read them from a text file. The code I have tried so far is not working, and I have experimented with other s ...

Horizontal scrollbar displayed by CSS Bootstrap

Experimenting with Bootstrap on a small project and encountering an issue that I can't seem to figure out. Here is the snippet of my code: nav{ background-color: lightblue; } section{ background-color: lightgreen; } <link href="http://netd ...

Removing an MySQL database using a PHP HTML button

While attempting to remove a row from my MySQL PHPMyAdmin database using a button in AssetApprovalForm.php, I encountered an issue. Upon clicking the decline button in AssetApprovalForm.php, nothing happens. Click here for the image of AssetApprovalForm.p ...

Calculate the sum of a specific column in an HTML table using JavaScript after

I have a function called CalColumnHistDEPOSITO() that I use to sum a table column as it loads from the server side into my HTML page. However, when I apply a filter, it continues to sum the entire table ignoring the filter. (function() { 'use stric ...

Utilizing SVG and CSS together: Implementing clip-path in a flexbox layout

This task may seem simple to some, but I am struggling to mask an image with an SVG graphic. I have created an SVG with the clipPath element: <svg id="heart-path-container" version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 ...

Tips for placing a large image within a small div

I have an image with a ratio of 1920*1300 that I want to be displayed on any device the website is viewed and cover the entire div. Check out my code below: .carousel { width: 100vw; height: 80vh; position: relative; } .carousel a { width: 1 ...

The data type 'string' cannot be assigned to the data type 'Position'

Currently, I am in the process of converting React js to typescript. The component being used is a Class Component. I would like to obtain CSS settings through props and apply them to an element. How can I resolve this issue? render(){return( <span st ...

Transforming Symbol Characters into HTML Using VB.NET

I want to make sure that any characters in my database entry that are not numeric or alphabetic get converted to HTML code. After doing some research, I came up with the following function: Public Shared Function HTMLEncodeSpecialChars(text As String) As ...