How to align contents horizontally and vertically in a div? - html

I tried to align content inside a div like this
but it shows me an unexpected behavior. Whenever I tried to use bootstrap class "pull-left" on span it behave like this. Also I want these contents vertically align in center. How can I do that.
.display-outside {
margin:20px 0;
}
.h1:hover {
color:#5d354a;
text-decoration:none;
}
span.extra > a {
padding:0 5px;
color:#444;
font-size:14px;
}
<div class="text-center display-outside">
<span class="pull-left">
<asp:Image ID="Image1" ImageUrl="~/images/logo/logo.jpg" Height="80px" Width="80px" CssClass="img-circle" runat="server" />
<i>Spirits Psychics</i>
</span>
<span class="extra">
Horoscopes
How It Works?
Need Help?
Questions&Answers
</span>
<span class="pull-right">
<i class="fa fa-facebook-square fa-3x social social-fb"></i>
<i class="fa fa-twitter-square fa-3x social social-tw"></i>
<i class="fa fa-google-plus-square fa-3x social social-gp"></i>
<i class="fa fa-instagram fa-3x social social-ig"></i>
</span>
</div>
<div>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#categories">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<asp:Image ID="Image2" ImageUrl="~/images/logo/logo.jpg" Width="50px" Height="50px" CssClass="display-inside img-circle" runat="server" />
<a class="navbar-brand display-inside" href="home.aspx">Spirit Psychics</a>
</div>
<div class="collapse navbar-collapse" id="categories">
<ul class="nav navbar-nav">
<li class="dropdown">
Psychics Reading
<ul class="dropdown-menu horizontal-menu">
<li class="left">menu</li>
<li class="left">menu</li>
<li class="left">menu</li>
<li class="left">menu</li>
<li class="left">menu</li>
<li class="left">menu</li>
<li class="left">menu</li>
<li class="left">menu</li>
<li class="left">menu</li>
</ul>
</li>
<li class="dropdown">
Love Psychics
<ul class="dropdown-menu horizontal-menu">
<li class="left">menu</li>
<li class="left">menu</li>
<li class="left">menu</li>
<li class="left">menu</li>
<li class="left">menu</li>
<li class="left">menu</li>
<li class="left">menu</li>
<li class="left">menu</li>
<li class="left">menu</li>
</ul>
</li>
<li>Tarot Reading</li>
<li>Fortune Telling</li>
<li>Dream Analysis</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">More <span class="caret"></span></a>
<ul class="dropdown-menu">
<li>Astrology Reading</li>
<li>Career Forecasts</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><span class="glyphicon glyphicon-user"></span> Join Now</li>
<li><span class="glyphicon glyphicon-log-in"></span> Login</li>
</ul>
</div>
</div>
</nav>
</div>
I don't know but it seems like something wrong with logo image.
Please give me solution.

An easy approach would be:
<div class="row display-outside">
<div class="text-left col-md-3">
<asp:Image ID="Image1" ImageUrl="~/images/logo/logo.jpg" Height="80px" Width="80px" CssClass="img-circle" runat="server" />
<i>Spirits Psychics</i>
</div>
<div class="extra text-center col-md-6">
<div class="center-v">
Horoscopes
How It Works?
Need Help?
Questions&Answers
</div>
</span>
<div class="text-right col-md-3">
<i class="fa fa-facebook-square fa-3x social social-fb"></i>
<i class="fa fa-twitter-square fa-3x social social-tw"></i>
<i class="fa fa-google-plus-square fa-3x social social-gp"></i>
<i class="fa fa-instagram fa-3x social social-ig"></i>
</div>
</div>
please note that I used the Bootstrap CSS class row for the wrapping div.
It should be wrapped in a container. Check the Bootstrap grid examples for more info on the use of 'col-...' classes.
Centering the links in the second div is done by the center-v class:
.center-v {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.extra {
...
position:relative; // Add this to your extra class
}

Related

How do I fix my lists so I don't have to toggle twice before the icon updates?

Basically what happens is when I load my page and then drop down either my outer collapsible menu (the .admin) or the nested collapsible menu (.unitsofstudy), it does not update the glyphicon I have set using the :after selector unless I toggle it twice.
Would anyone be able to take a look and see if they can spot where I have screwed this up; I have been at this for a few hours now trying to fix but with no success. If any more info is needed let me know.
HTML:
<div id="sidebar-collapse" class="col-sm-3 col-lg-2 sidebar">
<ul class="nav menu" id="navmenu-sidebar">
<!-- Admin dropdown -->
<li>
<a class="admin" data-toggle="collapse" href="#admin"><i class="fa fa-tasks" style="margin-right: 16px;"></i>Admin</a>
<ul id="admin" class="nav collapse">
<li>
<a class="unitsofstudy" data-toggle="collapse" href="#unitsofstudy"> <i class="fa fa-book" style="margin-right: 12px;"></i>Units of Study</a>
<ul id="unitsofstudy" class="nav collapse">
<li>
<i class="fa fa-book" style="margin-right: 8px;"></i> View Units
</li>
<li>
<i class="fa fa-plus" style="margin-right: 10px;"></i> Create Unit Offerings
</li>
<li>
<i class="fa fa-plus" style="margin-right: 10px;"></i> Register Units
</li>
<li>
<i class="fa fa-plus" style="margin-right: 10px;"></i> Register Semesters
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
My CSS:
.admin:after, .unitsofstudy:after {
font-family: 'Glyphicons Halflings';
content: "\e114";
float: right;
color: grey;
}
.admin.collapsed:after, .unitsofstudy.collapsed:after {
content: "\e080";
}
You need to give your anchors an initial class of .collapsed
<li>
<a class="admin collapsed" data-toggle="collapse" href="#admin">
<i class="fa fa-tasks" style="margin-right: 16px;"></i>Admin
</a>
</li>
So class both admin and unitsofstudy to let bootstrap know the initial state of the menu is collapsed
Working example
http://codepen.io/jcoulterdesign/pen/6443069430f54e0b635e726c2cb9da02

How to show Bootstrap dropdown above everything?

I have this problem:
(sorry for the Greek).
I want this dropdown menu, positioned on top of everything else on the page.
I don't think that I can use position:fixed, as I want the dropdown to always be below the blue button above it.
Here is the html (I'm using bootstrap):
https://jsfiddle.net/9pLg1kLy/2/
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<div class="navbar-default sidebar" role="navigation">
<div id="navbar-root-div" class="sidebar-nav navbar-collapse in">
<ul class="nav" id="side-menu">
<!--<sidebar-search></sidebar-search>-->
<li ng-show=currentUser ui-sref-active="active"> <a ui-sref="dashboard.map"><i class="fa fa-map fa-fw"></i> Χάρτης</a>
<!-- </li>
<li ng-show=currentUser ui-sref-active="active">
<a ui-sref="dashboard.chart"><i class="fa fa-line-chart fa-fw"></i> Δείκτες Απόδοσης</a>
</li>-->
<li id="deleteDevicePathsID" ng-show="devicePaths.p1" ui-sref-active="active"> </i> Διαγραφή Διαδρομών
</li>
<li ng-class="{active: collapseVar==1}" ng-cloak ng-show="devicesLoaded && currentUser">{{dropDown}} <a href="" ng-click="check(1)"><i class="fa fa-car fa-fw"></i> Συσκευές<span ng-show=DevicesArray
class="fa arrow"></span></a>
<ul id="deviceDataList" class="nav nav-second-level" collapse="collapseVar!=1">
<li ng-show=devicesLoaded class="sidebar-search">
<div class="input-group custom-search-form">
<input type="text" class="form-control" ng-model="searchText" placeholder="Αναζήτηση..."> <span class="input-group-btn">
<!--<button class="btn btn-primary dropdown" type="button"></button> -->
<div class="dropdown">
<a id="toolsDrop" href="" role="button"
class="dropdown-toggle btn btn-primary"
data-toggle="dropdown"
style="padding: 6px 6px 6px 8px;">Φίλτρα <b
class="caret"></b></a>
<ul class="dropdown-menu" style="min-width: 0; top: 34px; left: -20px;">
<li>
<a href="" style="padding: 6px; min-width: 0"
ng-click="statusFilter = movingFilter"> <img
src="misc/images/pinOntheMove.png"> Κινείται</a>
</li>
<li><a href="" style="padding: 6px;min-width: 0"
ng-click="statusFilter = stoppedFilter"> <img
src="misc/images/pinStopped.png"> Σε Στάση</a>
</li>
<li><a href="" style="padding: 6px;min-width: 0"
ng-click="statusFilter = unknownFilter"> <img
src="misc/images/pinUnknown.png"> Άγνωστο</a>
</li>
<li class="divider hidden-xs"></li>
<li><a href="" style="padding: 6px;min-width: 0"
ng-click="statusFilter = allFilter"> <i class="fa fa-th-list"></i> Όλα</a>
</li>
</ul>
</div>
</span>
</div>
</li>
<li>
<ul class="nav nav-second-level sidebar-device-list">
<li ng-init="third=!third" ng-class="{active: multiCollapseVar==3}" ng-repeat="device in DevicesArray | filter:dataFilter | filter:searchText | filter: statusFilter" id="{{device.DeviceId}}" lat="{{device.DeviceData.Position.Y}}" lng="{{device.DeviceData.Position.X}}" ui-sref-active="active"> <a style="font-weight:bold; border-style: none none solid none;" href="" ng-click="CenterMapOnPosition(device.DeviceData.Position, device.DeviceData.DeviceId)"><img
width="26"
height="26"
ng-src="misc/images/pin{{device.DeviceData.State}}.png">
{{device.Name}} <p style="font-weight: normal; color: #002a80">{{device.DeviceData.Location}}</p></a>
</li>
</ul>
</li>
</ul>
<li ng-show="devicesLoaded && currentUser" ui-sref-active="active"> </i><i ng-hide="labelsShown" class="fa fa-square-o fa-fw"></i> Ονόματα Οχημάτων
</li>
<li ng-show=currentUser ui-sref-active="active"> </i> Αποσύνδεση
</li>
</ul>
</div>
</div>
The dropdown menu is at line 32.
Try to add z-index with position:relative that's make it visible
Try adding a z-index on the element which is cut off. This will bring the element to the front

Bootstrap Centering Content within a Div

Basically I want my drop down boxes to be horizontally aligned in the center of the <div>. Currently they are in a column and inside a <div> which has displayed them vertically, by default and has pushed the content to the left of the <div>.
I'm using the latest version of bootstrap and only have CSS to pad the header and to set it as transparent!
<div class=" navbar transparent navbar-default navbar-fixed-top" role="navigation"> <!--HEADER-->
<div class="container-fluid header"> <!--CONTAINER- Needs to be inset slightly-->
<div class="row">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!--First NavBar Colum - Logo is Located Here-->
<div class=" navbar-collapse collapse">
<div class="col-sm-4 ">
</div>
<!--Second NavBar Colum - Centered Horizontal Navigation Links are Located Here-->
<div class="col-sm-4 ">
<ul class="nav navbar-nav navbar-left">
<ul class="dropdown">
<i class="fa fa-circle-o"></i>
PLAY
<ul class="dropdown-menu">
<li class="divider"></li>
<li>Public Teatimes</li>
<li>Member Teatimes</li>
<li>Course Tour</li>
<li>Rates and Ratings</li>
<li>Outings</li>
</ul>
</ul>
<ul class="dropdown">
<i class="fa fa-circle-o"></i>
CLUB
<ul class="dropdown-menu">
<li class="divider"></li>
<li>Membership</li>
<li>Calender</li>
<li>Lessons and Shop</li>
<li>Bar and Food</li>
</ul>
</ul>
<ul>
<i class="fa fa-circle-o"></i>
CONTACT
</ul>
</ul>
</div>
<!--Third NavBar Colum - Social Media Icons are Located Here-->
<div class="col-sm-4">
<i class="fa fa-facebook-square fa-3x"></i>
<i class="fa fa-twitter-square fa-3x"></i>
<i class="fa fa-instagram fa-3x"></i>
</div>
</div> <!--/ .nav-collapse-->
</div>
</div>
</div>
In .navbar-nav, .navbar-left there is float:left . SO, you have remove that first float:none. Then on parent col-sm-4 you can add .text-center.
Try something like this
.navbar-nav{
width:250px;
margin:0 auto;
float:none;
text-align:center;
}
And remove float from <li> if you use.
#media (min-width: 768px)
.navbar-nav {
text-align: center;}

Foundation - Top Bar and Icon Bar in one template

I'm working on Foundation Zurb template and I'm trying to get it working.
I have Top Bar at the top of the screen (full width), Icon Bar at the left side (full height). I know that Foundation has 12 grid system.
According to Foundation:
The Foundation Top Bar gives you a great way to display a complex
navigation bar on small, medium or large screens.
And:
An Icon Bar provides a menu to quickly navigate an app. Use the Icon
Bar horizontally or vertically, with the labels below the icons or to
the right. Have it your way.
Here is my template. I've took out div.large-9.columns etc.. Because they were braking the view.
<!-- Navigation -->
<nav class="top-bar" data-topbar role="navigation">
<ul class="title-area">
<li class="name">
<h1>LOGO PLACEHOLDER</h1>
</li>
<li class="toggle-topbar menu-icon"><span>Menu</span></li>
</ul>
<section class="top-bar-section">
<!-- Right Nav Section -->
<ul class="right">
<li class="active"><i class="fa fa-diamond"></i> Go PRO</li>
<li class="has-dropdown">
<i class="fa fa-user"></i> My Account
<ul class="dropdown">
<li>Some Li's here</li>
</ul>
</li>
</ul>
<!-- Left Nav Section -->
<ul class="left">
<li><i class="fa fa-database"></i> ONE</li>
<li><i class="fa fa-list-ol"></i> TWO</li>
<li><i class="fa fa-users"></i> THREE</li>
</ul>
</section>
</nav>
<!-- Left Nav Sidebar -->
<div class="icon-bar vertical five-up">
<a class="item">
<i class="fa fa-home"></i>
<label>Home</label>
</a>
<a class="item">
<i class="fa fa-gamepad"></i>
<label>ONE</label>
</a>
<a class="item">
<i class="fa fa-star"></i>
<label>TWO</label>
</a>
<a class="item">
<i class="fa fa-thumbs-up"></i>
<label>THREE</label>
</a>
<a class="item">
<i class="fa fa-trophy"></i>
<label>FOUR</label>
</a>
</div>
I want to achieve:
Top Bar and Icon Bar the same
Content Area to be fixed and have large-8 or large-9
Sidebar to be fixed and have large-3
What I've already tried:
Was separating all 3 bits with div.large-1/8/3, nothing happened
Was nesting them into div.row
I think I've tried almost everything, but have no idea, what is the problem.
i had done the changes in html and css. this what your expecting
html code
<nav class="top-bar" data-topbar role="navigation">
<ul class="title-area">
<li class="name">
<h1>LOGO PLACEHOLDER</h1>
</li>
<li class="toggle-topbar menu-icon"><span>Menu</span></li>
</ul>
<section class="top-bar-section">
<!-- Right Nav Section -->
<ul class="right">
<li class="active"><i class="fa fa-diamond"></i> Go PRO</li>
<li class="has-dropdown">
<i class="fa fa-user"></i> My Account
<ul class="dropdown">
<li>Some Li's here</li>
</ul>
</li>
</ul>
<!-- Left Nav Section -->
<ul class="left">
<li><i class="fa fa-database"></i> ONE</li>
<li><i class="fa fa-list-ol"></i> TWO</li>
<li><i class="fa fa-users"></i> THREE</li>
</ul>
</section>
</nav>
<!-- Left Nav Sidebar -->
<div class="medium-1 columns left-nav">
<div class="icon-bar vertical five-up">
<a class="item">
<i class="fa fa-home"></i>
<label>Home</label>
</a>
<a class="item">
<i class="fa fa-gamepad"></i>
<label>ONE</label>
</a>
<a class="item">
<i class="fa fa-star"></i>
<label>TWO</label>
</a>
<a class="item">
<i class="fa fa-thumbs-up"></i>
<label>THREE</label>
</a>
<a class="item">
<i class="fa fa-trophy"></i>
<label>FOUR</label>
</a>
</div>
</div>
<div class="medium-8 columns content-area">content-area</div>
<div class="medium-3 columns sidebar">columns sidebar</div>
css code
.columns.content-area{border:1px solid #111;padding:0}
.columns.sidebar{border:1px solid #111;padding:0}
.columns.left-nav{padding:0}
.icon-bar.vertical.five-up{width:100%}
demo jsFiddle

Making the content adjust when navigation sidebar is collapsed Bootstrap

Hi I am new to CSS and bootstrap. I have a button which will make the navigation sidebar collapsible and all i need is to make the content of the page to float to the left when the navigation sidebar is collapsed and shrink if the navigation sidebar is expanded.
Kindly suggest me a solution :(
below is my sample code
<nav class="navbar navbar-default navbar-fixed-top" role="navigation" >
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header ">
<button type="button" class="navbar-toggle visible-lg" data-toggle="collapse" data-target="#navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="collapse navbar-default navbar-collapse" >
<div class="pull-left" id="navbar-ex1-collapse">
<ul class="nav navbar-default navbar-nav side-nav">
<li class="dropdown">
<i class="fa fa-user"></i> My Profile <b class="caret"></b>
<ul class="dropdown-menu">
<li ><a class="dropdown-color" href="#" style="background:rgba(59, 89, 152, 0.28);" ><i class="fa fa-user"></i> View Profile</a></li>
<li><a class="dropdown-color" href="#" style="background:rgba(59, 89, 152, 0.28);"><i class="fa fa-edit"></i> Edit Profile</a></li>
</ul>
</li>
<li><i class="fa fa-dashboard"></i> Dashboard</li>
<li class="dropdown">
<i class="fa fa-desktop"></i> Deployment <b class="caret"></b>
<ul class="dropdown-menu">
<li><i class="fa fa-edit"></i> Deployment Parameter</li>
<li><i class="fa fa-bar-chart-o"></i> Package Deployment</li>
<li><i class="fa fa-bar-chart-o"></i> Release Deployment</li>
</ul>
</li>
</ul>
</div>
<ul class="nav navbar-nav navbar-right navbar-user">
<li class="dropdown user-dropdown">
<i class="fa fa-user"></i> Username <b class="caret"></b>
<ul class="dropdown-menu">
<li><i class="fa fa-user"></i> View Profile</li>
<li><i class="fa fa-gear"></i> Edit Profile</li>
<li class="divider"></li>
<li><i class="fa fa-power-off"></i> Log Out</li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
<div class="auto-adjust" id="page-wrapper">
//table goes here
</div>
below is my css class which i wrote for adjusting the content
CSS:
.auto-adjust{
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
margin:0;
float:left;
}
In Twitters Less code the point that the navbar collapse has been set by #grid-float-breakpoint (set to 768px) by default. Now you can use CSS media queries to only apply your code before that point:
less
#media (max-width: (#grid-float-breakpoint - 1)) {
padding-right: 15px;
padding-left: 15px;
margin: 0 auto;
float:left;
}
CSS output:
#media (max-width: 767px) {
padding-right: 15px;
padding-left: 15px;
margin: 0 auto;
float: left;
}
Notice that you probably better can use Bootstrap's grid, see http://getbootstrap.com/css/#grid-media-queries. The xs grid will be applied when the green width is smaller than 768 pixels too.
Try the following code:
<div class="row">
<div class="col-xs-12 col-sm-6">//table goes here</div>
<div class="col-xs-12 col-sm-6">//other content</div>
</div>