Bootstrap3 grid layout - html

i can't find a way to make that work.
i have a sidebar which i pull to the right on desktop side.
i don't know on what row to put the pink div.
This is what i wrote but i don't think it's good.. http://jsfiddle.net/o7vmx2to/
<div class="row">
<article class="col-xs-24 col-sm-18 pull-right">
<div>Left div</div>
</article>
<aside class="col-xs-24 col-sm-6 pull-left">
<div class="row">
<div class="col-xs-24">
<ul class="list-unstyled button_list">
<li>button a</li>
<li>button b</li>
<li>button c</li>
<li>button d</li>
<li>button e</li>
<li>button f</li>
</ul>
</div>
</div>
<div class="row">
<div>This one need to be moved</div>
</div>
</aside>

You need to wrap your stuff in a <div class="container"> which automatically resizes when you change from xs to sm,md and lg
Bootstrap grid system is based on 12 columns not 24. So divide everything by 2
JSFiddle : http://jsfiddle.net/snatgu5f/
Actually it would be a lot easier if you swapped the blue and green divs in the left picture. Because then you end up with a standard bootstrap layout without the need for .pull-right class. I suspect you might actually want this. The code would need to be like this :
<div class="container"><div class="row">
<div class="col-xs-12 col-sm-3">
<nav><ul class="nav nav-stacked nav-pills">
<li class="diabled">Menu</li>
<li>Something</li>
</ul></nav>
</div>
<div class="col-xs-12 col-sm-9">
<article class="row">
Some Text
</article>
<article class="row">
Some more text
</article>
</div>
</div></div>
Yet if you really need the blocks to be positionned like in your picture, here's what you could do (the trick is ton only have one row and either to make the left-menu "pull-left" or the other blocks "pull-right"
<div class="container">
<div class="row">
<article class="col-xs-12 col-sm-9 pull-right">
Green Block </article>
<nav class="col-xs-12 col-sm-3">
<ul class="list-unstyled button_list">
<li>button a</li>
<li>button b</li>
<li>button c</li>
<li>button d</li>
<li>button e</li>
<li>button f</li>
</ul>
</nav>
<article class="col-xs-12 col-sm-9 pull-right">
Purple block</article>
</div>

Related

Hover on DIV (increase height - top and bottom) without affecting other DIVs

I have this issue of hovering a div element. I want to increase the height of a div from top and bottom on hover, however, it moves the other divs. Here is the pen. Thanks for the help!
Sample code only
<div class="container text-center key-industries">
<h2 class="margin-bottom-sm"><span class="text-gradient">9 Key</span> Industries</h2>
<div class="row">
<div class="col-lg-4 col-md-12 text-center grey-box">
<h3>LOREM IPSUM</h3>
<span class="number-shadow">01</span>
<ul>
<li>Web Design</li>
<li>Graphic Design</li>
<li>Search Engine Optimization (SEO)</li>
<li>PPC Advertising </li>
</ul>
</div>
<div class="col-lg-4 col-md-12 text-center grey-box">
<h3>LOREM IPSUM</h3>
<span class="number-shadow">02</span>
<ul>
<li>Web Design</li>
<li>Graphic Design</li>
<li>Search Engine Optimization (SEO)</li>
<li>PPC Advertising </li>
</ul>
</div>
<div class="col-lg-4 col-md-12 text-center grey-box">
<h3>LOREM IPSUM</h3>
<span class="number-shadow">03</span>
<ul>
<li>Web Design</li>
<li>Graphic Design</li>
<li>Search Engine Optimization (SEO)</li>
<li>PPC Advertising </li>
</ul>
</div>
</div>
</div>
with css when you hover over an element with class "grey-box" and changing the style of this class on hover keep in mind that all other boxes have the same class name "grey-box" then height of all boxes will be effected .. because all boxes have class "grey-box" , there are two solutions either give every box one different class like b1,b2,b3,b4 or other solution is to use javascript and loop through all elements and use onmouseover event . you can watch this as well for better visual understanding of code
codemyui

Auto resize card-content (materialize css) with an ag-Grid in it

In a card-tabs element from materialize css framework I'm trying to setup an ag-grid table.
Here is the code.
<div class="card-tabs">
<ul class="tabs tabs-fixed-width">
<li class="tab">Test 4</li>
<li class="tab">Test 5</li>
</ul>
</div>
<div class="card-content grey lighten-5">
<div id="test4" style="height: 200px;">
<div ag-grid="$ctrl.gridOptions" class="ag-theme-material" style="height: 100%;"></div>
</div>
<div id="test5">Test 5 content</div>
</div>
</div>
The problem is that I cannot auto resize the height of the element with id='test4' in order to gird be viewable. If I remove the style="height:200px;" from it, the grid doesn't show up. If I added it's being shown but I don't want to keep it statically on 200px since the grid's height could be varied.
Is there any way to make the div with the id='test4' automatically resize itself according to the size of the ag-grid?
I tried to put height:auto; both in card-content and test4 divs but without any success.
Div will not be shown if there is not content in it. Why don't you just put blank &nbsp value inside html.
<div class="card-tabs">
<ul class="tabs tabs-fixed-width">
<li class="tab">Test 4</li>
<li class="tab">Test 5</li>
</ul>
</div>
<div class="card-content grey lighten-5">
<div id="test4"
<div ag-grid="$ctrl.gridOptions" class="ag-theme-material" style="height: 100%;"></div>
</div>
<div id="test5">Test 5 content</div>
</div>
</div>

How to build this structure in HTML with Bootrstap?

I have this sample:
link
CODE HTML:
<header>
<div class="row">
<div class="col-md-push-8 col-md-4 menu-top">
<ul>
<li>text 1</li>
<li>text 2</li>
<li>text 3</li>
</ul>
</div>
<div class="col-md-4"> //this structure need to be below (not inline)
11231231
</div>
<div class="col-md-4">
11231231
</div>
<div class="col-md-4">
11231231
</div>
</div>
</header>
I put an image to understand better what I want to do
http://i64.tinypic.com/3342ofa.png
How to build HTML structure so as to be like in the picture above?
Thanks in advance!
Use thumbnail for image which is a class of Bootstrap.
Example :
<div class="col-md-4">
<a href="example.jpg" class="thumbnail">
<p>Stack Overflow</p>
<img src="stack.jpg" alt="Stack Overflow" style="width:150px;height:150px">
</a>
</div>

How to add an h2 into a MeanMeanu container

Im working on a website that uses the meanmenu, and Ive been struggling for two days on how to get a title to appear inside the mean menu container.
heres my html for the menu:
<div class="row">
<div class="col-lg-4 col-md-8 col-sm-4">
<h2>Title Text</h2>
</div>
<div class="col-lg-8 col-md-12 col-sm-12 hidden-xs">
<div class="main-menu float-right">
<nav>
<ul>
<li class="active">Home</li>
<li>About Us</li>
<li>What We Do</li>
<li>Our Work</li>
<li>Contact Us</li>
</ul>
</nav>
</div>
</div>
<div class="hidden-sm hidden-lg hidden-md col-sm-2">
<div class="mobile-menu">
<nav>
<ul>
<li class="active">Home</li>
<li>About Us</li>
<li class="hidden-xs">What We Do</li>
<li>Our Work</li>
<li>Contact Us</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
Heres how it looks expanded:
Collapsed I can't figure out how to get it to stay inline:
I've seen a few posts on similar issues but nothing has worked for me. Im wondering if anyone has done this before?
This happens because you use bootstrap classes not in a right manner
This should works (hope so, because you hide .css from us :) )
<div class="row">
<div class="col-xs-6 col-sm-4 col-md-8 col-lg-4">
<h2>Title Text</h2>
</div>
<div class="visible-xs col-xs-6">
<div class="mobile-menu">
</div>
</div>
</div>
maybe cuz u didnt set col-xs-* grids for your Title Text ( hence its taking 12 columns) try that and if possible please post a jsfiddle :)

How to center on HTML5?

On my website, I was previously displaying 4 plan cards. I'm looking on displaying only 3 cards, so I commented one of them. As result, they are not centered. How can I center them?
Here's how it's being currently displayed:
Here's the code:
<!-- Row fuid-->
<div class="row">
<!-- Item table -->
<div class="col-sm-6 col-md-4 col-lg-3">
<div class="item_table">
<div class="head_table">
<h1>FREE</h1>
<h2>£ 0.00 <span>/ Mo</span></h2>
</div>
<ul>
<li class="color">2 GB HDD</li>
<li>25GB Bandwidth</li>
<li class="color">1 E-mail Account</li>
<li>1 Sub Domains</li>
<li class="color">cPanel/Site Creator</li>
<li>1 FTP Account</li>
<li class="color">1 Cron Job</li>
<li>1 Addon Domain</li>
<li class="color">1 Parked Domain</li>
</ul>
Order Now
</div>
</div>
<!-- End Item table -->
<!-- Item table -->
<div class="col-sm-6 col-md-4 col-lg-3">
<div class="item_table">
<div class="head_table">
<h1>PREMIUM</h1>
<h2>£ 0.99 <span>/ Mo</span></h2>
</div>
<ul>
<li class="color">30 GB HDD</li>
<li>1000GB Bandwidth</li>
<li class="color">1024MB RAM</li>
<li>2 Dedicated IP Addresses</li>
<li class="color">cPanel/WHM Included</li>
<li>Open VZ Included</li>
</ul>
Order Now
</div>
</div>
<!-- End Item table -->
<!-- Item table -->
<!--<div class="col-sm-6 col-md-4 col-lg-3">
<div class="item_table">
<div class="head_table">
<h1>V.I.P</h1>
<h2>£ 2.00 <span>/ Mo</span></h2>
<!--<h5>Or $ 150.5 Yearly!</h5>
</div>
<ul>
<li class="color">30 GB HDD</li>
<li>1000GB Bandwidth</li>
<li class="color">1024MB RAM</li>
<li>2 Dedicated IP Addresses</li>
<li class="color">cPanel/WHM Included</li>
<li>Open VZ Included</li>
</ul>
Order Now
</div>
</div>-->
<!-- End Item table -->
You can still use <div align="center">stuff here</div> and it will work fine just if you want the containing items to not center content on them say <tag style="text-align:left;">...</tag>
Another way is to inside your CSS file have the following code:
* { margin:0px auto; }
div.container { width:1000px; border:1px solid black; }
The * applies to the entire page and sets up the page to be centered.
You then need some other tag like div with a set width to take advantage of the property.
In your HTML file:
<div class="container">...</div>
I think there's two answers...
CSS has text-align: center and with Bootstrap's 12 column layout, you need to give each column 4 each I used the col-sm-4 since JSFiddle's window is small.
Here's my example:
http://jsfiddle.net/N7mvN/ make sure to pull the display window open wider to see it
Here's the HTML:
<!-- Row fuid-->
<div>
<div class="row" style="margin:0 auto">
<!-- Item table -->
<div class="col-sm-4">
<div class="item_table" style="background-color:red">
<div class="head_table">
<h1>FREE</h1>
<h2>£ 0.00 <span>/ Mo</span></h2>
</div>
<ul>
<li class="color">2 GB HDD</li>
<li>25GB Bandwidth</li>
<li class="color">1 E-mail Account</li>
<li>1 Sub Domains</li>
<li class="color">cPanel/Site Creator</li>
<li>1 FTP Account</li>
<li class="color">1 Cron Job</li>
<li>1 Addon Domain</li>
<li class="color">1 Parked Domain</li>
</ul>
Order Now
</div>
</div>
<!-- End Item table -->
<!-- Item table -->
<div class="col-sm-4">
<div class="item_table" style="background-color:green">
<div class="head_table">
<h1>PREMIUM</h1>
<h2>£ 0.99 <span>/ Mo</span></h2>
</div>
<ul>
<li class="color">30 GB HDD</li>
<li>1000GB Bandwidth</li>
<li class="color">1024MB RAM</li>
<li>2 Dedicated IP Addresses</li>
<li class="color">cPanel/WHM Included</li>
<li>Open VZ Included</li>
</ul>
Order Now
</div>
</div>
<!-- End Item table -->
<!-- Item table -->
<div class="col-sm-4">
<div class="item_table" style="background-color:blue">
<div class="head_table">
<h1>V.I.P</h1>
<h2>£ 2.00 <span>/ Mo</span></h2>
<h5>Or $ 150.5 Yearly!</h5>
</div>
<ul>
<li class="color">30 GB HDD</li>
<li>1000GB Bandwidth</li>
<li class="color">1024MB RAM</li>
<li>2 Dedicated IP Addresses</li>
<li class="color">cPanel/WHM Included</li>
<li>Open VZ Included</li>
</ul>
Order Now
</div>
</div>
<!-- End Item table -->
</div>
</div>
And some extra CSS:
.item_table {
margin:1.5em;
padding:1em;
text-align:center;
}
Wrap them all in a div with the style attribute set to margin: 0px auto; width: 1000px; where 1000px is the width of the contained elements. ie. will need to be changed considering I don't know the widths of your elements.
html:
<div class="container">
<div class="third inline"><!-- content --></div>
<div class="third inline"><!-- content --></div>
<div class="third inline"><!-- content --></div>
</div>
css
.third{
width:30%;
margin:0;}
.inline{
display:inline-block;}
.container{
width:50%;/*whatever*/
margin:0 auto;}