So guys my questions says I am trying to make 4 DIV's being in the same line/row however.
Product Company (middle) Languages DIV4
text... text... text... text...
text... text... text... text...
it should look something like that... .I hope you do understand what i mean!
so this is my code: `
<div class="container">
<div class="row">
<div class="col-md-4">
<h2>Product</h2>
<li> Templates</li>
<li> Pricing</li>
</div>
<div class="col-md-4">
<h2>Company</h2>
<li>About Us</li>
<li>Contact us</li>
<li>Terms of Servise</li>
<li>Privacy policy</li>
</div>
<div class="col-md-4">
<h2>Language</h2>
<li>Englisch</li>
<li>German</li>
<li>Srpski</li>
</div>
<div class="col-md-4">
<li>facebook</li>
<li>kaaa</li>
<li>kaaa</li>
</div>
</div>
</div>
First make sure that your markup is valid. E.g. for your li tags the ul tag was missing.
If you want to display 4 divs, you need the class col-md-3 instead of col-md-4. Bootstrap is using a grid system with a default column count of 12. If you need 4 columns you have to use 12/4 = 3 meaning col-md-3.
The md stands for medium. So for small devices, the columns break and are displayed on top of each other. Watch the following example in fullscreen, to see the columns standing next to each other.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-md-3">
<h2>Product</h2>
<ul>
<li> Templates</li>
<li> Pricing</li>
</ul>
</div>
<div class="col-md-3">
<h2>Company</h2>
<ul>
<li>About Us</li>
<li>Contact us</li>
<li>Terms of Servise</li>
<li>Privacy policy</li>
</ul>
</div>
<div class="col-md-3">
<h2>Language</h2>
<ul>
<li>Englisch</li>
<li>German</li>
<li>Srpski</li>
</ul>
</div>
<div class="col-md-3">
<ul>
<li>facebook</li>
<li>kaaa</li>
<li>kaaa</li>
</ul>
</div>
</div>
</div>
Could be a screen size issue and also sytax issue
Bootstrap only allows 12 columns per row, so each column needs "width" of 3, col-md-3
Then since the size is set to md the columns widths are set up for a medium size screen
With col-xs-3 it will make the columns as small as they can go without overflowing to the next row
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="col-md-3 col-xs-3">
<h2>Product</h2>
<ul>
<li> Templates
</li>
<li> Pricing
</li>
</ul>
</div>
<div class="col-md-3 col-xs-3">
<h2>Company</h2>
<ul>
<li>About Us
</li>
<li>Contact us
</li>
<li>Terms of Servise
</li>
<li>Privacy policy
</li>
</ul>
</div>
<div class="col-md-3 col-xs-3">
<h2>Language</h2>
<ul>
<li>Englisch
</li>
<li>German
</li>
<li>Srpski
</li>
</ul>
</div>
<div class="col-md-3 col-xs-3">
<h2>Share</h2>
<ul>
<li>facebook
</li>
<li>kaaa
</li>
<li>kaaa
</li>
</ul>
</div>
</div>
</div>
check this snippet
.row {
display: flex;
}
<div class="container">
<div class="row">
<div class="col-md-4">
<h2>Product</h2>
<ul>
<li> Templates
</li>
<li> Pricing
</li>
</ul>
</div>
<div class="col-md-4">
<h2>Company</h2>
<ul>
<li>About Us
</li>
<li>Contact us
</li>
<li>Terms of Servise
</li>
<li>Privacy policy
</li>
</ul>
</div>
<div class="col-md-4">
<h2>Language</h2>
<ul>
<li>Englisch
</li>
<li>German
</li>
<li>Srpski
</li>
</ul>
</div>
<div class="col-md-4">
<h2>div4</h2>
<ul>
<li>facebook
</li>
<li>kaaa
</li>
<li>kaaa
</li>
</ul>
</div>
</div>
</div>
Hope this helps
Related
I am trying align it so that it will be tests as heading, then gibberish 1, 2, 3 on same row under it. i don't know what I'm doing wrong. right now it only shows as gibberish 1 under it on the left. can someone please help me out?
<div class="container">
<div class="row" id="tests">
<div class="test col-md-12">
<h2>tests</h2><br>
<ul class="col-md-4">
<li>
gibberish 1
</li>
<li>
gibberish 1
</li>
<li>
gibberish 1
</li>
<li>
gibberish 1
</li>
</ul>
<ul class="col-md-4">
<li>
gibberish 2
</li>
</ul>
<ul class="col-md-4">
<li>
gibberish 3
</li>
</ul>
</div>
</div>
</div>
Wrap your ul on one div with class name row like
<div class="row">
<ul class="col-md-4">
<link href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.1/dist/css/bootstrap.min.css" rel="stylesheet"/>
I am trying align it so that it will be tests as heading, then gibberish 1, 2, 3 on same row under it. i don't know what I'm doing wrong. right now it only shows as gibberish 1 under it on the left. can someone please help me out?
<div class="container">
<div class="row" id="tests">
<div class="test col-md-12">
<h2>tests</h2><br>
<div class="row"><!-- Add This -->
<ul class="col-md-4">
<li>
gibberish 1
</li>
<li>
gibberish 1
</li>
<li>
gibberish 1
</li>
<li>
gibberish 1
</li>
</ul>
<ul class="col-md-4">
<li>
gibberish 2
</li>
</ul>
<ul class="col-md-4">
<li>
gibberish 3
</li>
</ul>
</div> <!-- Add This -->
</div>
</div>
</div>
I'm not sure if wrap is the right word, but i have a column that can be very long.
And i would like it to wrap to the next set of columns when it reaches the end of the div.
what i would like:
col-3 col-3 a
a a a
a a a
a a col-3
a a a
______________ end of div
I would like the second col-3 to wrap at the size of the first col-3, in the end to have 2 columns the same size and one with what's left over after the length is filled.
What i have right now:
col-3 col-3 col-3
a a a
a a
a a
a a
a
a
a
a
______________ end of div
My code:
<div className="container">
<h2>{listing.name}</h2>
<div className="row">
<div className="col-md-6">
<SlickAll />
<ul>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
</ul>
</div>
<div className="col-md-3 mh-100">
<ul className="list-group">
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
<li>asd </li>
</ul>
</div>
<div className="col-md-3 mh-100">
<ul className="list-group">
<li>asd </li>
</ul>
</div>
</div>
</div>
You can use flexbox column wrap, and limit the height of the right side columns by placing them in a position:absolute container...
<div class="row my-3 mx-auto">
<div class="col-md-6">
<ul class="list-group">
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
...
</ul>
</div>
<div class="col-md">
<div class="position-absolute w-100 h-100">
<ul class="list-group d-flex flex-column flex-wrap mh-md-100">
<li>list</li>
<li>list</li>
<li>list</li>
<li>list</li>
...
<li>listend</li>
</ul>
</div>
</div>
</div>
https://www.codeply.com/go/L7WH4YZNBW
The only extra CSS is to make the max-height work responsively. This allows the columns to stack vertically on smaller screens (less than md width)...
#media (min-width: 768px) {
.mh-md-100 {
max-height: 100%;
}
}
How can I add submenu to the following sidenav?
<ul class="sidenav sidenav-fixed" id="nav-mobile" style="width:250px">
<li> Text here</li>
<li>
<div class="divider"></div>
</li>
<li>
<a onclick="load('home')"><i class="material-icons">home</i>Home</a>
</li>
<li><a onclick="load('intro')"><i class="material-icons">apps</i>Content Table</a></li>
</ul>
MaterializeCSS documentation site uses a collapsible inside the sidenav:
https://materializecss.com/collapsible.html
Collapsible is a separate component that also needs initialising:
document.addEventListener('DOMContentLoaded', function() {
var elems = document.querySelectorAll('.collapsible');
var instances = M.Collapsible.init(elems);
});
Working codepen:
https://codepen.io/doughballs/pen/RwPWVqy
The actual markup taken from the Materialize doc site is:
<!-- Start nested content -->
<li>
<ul class="collapsible collapsible-accordion">
<li>
<a class="collapsible-header waves-effect waves-teal" tabindex="0"><i class="material-icons">menu</i>Nested</a>
<div class="collapsible-body">
<ul>
<li>Color</li>
<li>Grid</li>
<li>Helpers</li>
<li>Media</li>
<li>Pulse</li>
<li>Sass</li>
<li>Shadow</li>
<li>Table</li>
<li>Transitions</li>
<li>Typography</li>
</ul>
</div>
</li>
</ul>
</li>
You can do something like below with MaterializeCSS
<div id="slide-out" class="sidenav" style="transform: translateX(0%);">
<ul class="collapsible">
<li class="active">
<div class="collapsible-header">
Group1
</div> <div class="collapsible-body" style="display: block;">
<li>Course 1</li>
<li>Course 2</li>
</div>
</li>
<li class="">
<div class="collapsible-header">
केंद्रीय लोकसेवा आयोग
</div>
<div class="collapsible-body" style="">
</div>
</li>
</ul>
</div>
I'm trying to get the logo and the nav bar links on the same line. The logo will appear by itself when it resizes to mobile.
This is the current:
Currently on two lines.
This is the html behind it:
<!-- header Area Start-->
<div class="header-area">
<div class="container">
<div class="row">
<div class="col-lg-2 col-md-3 col-12">
<div class="logo">
<a href="index-2.html">
<img src="assets/img/logo.png" alt="">
</a>
</div>
</div>
<div class="col-lg-10 text-right col-md-9 col-12">
<div class="responsive_menu"></div>
<div class="mainmenu-area">
<ul id="nav">
<li>Home <i class="fa fa-angle-down"></i>
<ul class="drop-menu">
<li>Rocket Home </li>
<li>Gradient Home </li>
</ul>
</li>
<li>Domain</li>
<li>Hosting <i class="fa fa-angle-down"></i>
<ul class="drop-menu">
<li>Hosting </li>
<li>Team </li>
<li>About us</li>
<li>Testimonial</li>
<li>FAQ</li>
</ul>
</li>
<li>Pages <i class="fa fa-angle-down"></i>
<ul class="drop-menu">
<li>Team </li>
<li>About us</li>
<li>Testimonial</li>
<li>FAQ</li>
<li>Service</li>
<li>Blog Details</li>
<li>404 Page</li>
<li>Coming Soon</li>
</ul>
</li>
<li>Blog</li>
<li>Support</li>
</ul>
</div>
<div class="search">
<span class="search-trigger"><i class="fa fa-search"></i></span>
<div class="search-box">
<form action="#">
<input type="text" name="s" placeholder="Search..">
<div class="submit-btn">
<input type="submit" value="Go">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- header Area end-->
Any suggestions on what I can do to make them all on one line?
Maximum size of the column in bootstrap is 12. Bootstrap adds padding and margin by default, so try using col-lg-8 and see what happens.
<div class="header-area">
<div class="container">
<div class="row">
<div class="col-lg-2 col-md-3">
<div class="logo">
<a href="index-2.html">
<img src="assets/img/logo.png" alt="">
</a>
</div>
</div>
<div class="col-lg-8 text-right col-md-9">
<div class="responsive_menu"></div>
<div class="mainmenu-area">
I use foundation 6 to build my website. Only a problem occurs when I shrink the size of my window.
Picture of my website
Does somebody know how to fix this?
An answer is appreciated.
<nav class="top-bar" data-topbar role="navigation">
<ul class="title-area">
<li class="name">
<h1><a href="#"><b>Pimg</b>
</a>
</h1>
</li>
<!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
<li class="toggle-topbar menu-icon"><span>Menu</span></li>
</ul>
<section class="top-bar-section">
<!-- Right Nav Section -->
<ul class="right">
<li> <div class="entypo-home entipo"></div></li>
<li> <div class="entypo-picture entipo"></div></li>
<li> <div class="entypo-upload entipo"></div></li>
<li> <div class="entypo-user entipo"></div></li>
</ul>
<ul class="left">
<li>Log out</li>
<li class="has-form">
<div class="row collapse">
<div class="medium-8 columns">
<input type="text" placeholder="Search...">
</div>
<div class="medium-4 columns">
Search
</div>
</div>
</li>
</ul>
</section>
</nav>