How to centralize the left nav - html

I having problems trying to centralize a bootstrap standard nav in a row.
<footer id="page_footer">
<div class="container">
<div class="row">
<div class="col-md-8">
<ul id="page_footer_links" class="nav nav-pills nav-center">
<li role="presentation">Home</li>
<li role="presentation">Profile</li>
<li role="presentation">Messages</li>
</ul>
</div>
<div class="col-md-4">
<p id="page_footer_wordpress" class="text-center">Orgulhosamente movido com WordPress!!!</p>
</div>
</div>
</div>
Here the complete fiddle: http://jsfiddle.net/vpontin/bkpnrLo0/
I tried putting text-center and center-block. None worked. Even putting margin 0 auto or text-align: center didn't work.
What i need to do?

The .nav-pills list items have default floating behavior to left. So change it to none and display them in one line using display: inline-block.
Updated JSfiddle
#page_footer {
background-color: #f5f5f5;
width: 100%;
}
#page_footer .container {
padding: 20px;
}
#page_footer_links {
margin: 0 auto;
text-align: center;
}
#page_footer_wordpress {
margin: 0px;
height: 40px;
line-height: 40px;
}
.nav-pills > li {
float: none !important;
display: inline-block !important;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<footer id="page_footer">
<div class="container">
<div class="row">
<div class="col-md-8">
<ul id="page_footer_links" class="nav nav-pills nav-center">
<li role="presentation">Home
</li>
<li role="presentation">Profile
</li>
<li role="presentation">Messages
</li>
</ul>
</div>
<div class="col-md-4">
<p id="page_footer_wordpress" class="text-center">Orgulhosamente movido com WordPress!!!</p>
</div>
</div>
</div>

Related

Place div side by side

My HTML code is like below
<div class="col-lg-4">
<ul>
<div class="area" id="div_1">
<li class="category" id="1">Hair</li>
</div>
<div class="area" id="div_3">
<li class="category" id="3">Skin Care</li>
</div>
<div class="area" id="div_4">
<li class="category" id="4">Makeup</li>
</div>
<div class="area" id="div_5">
<li class="category" id="5">Body Treatments</li>
</div>
<div class="area" id="div_6">
<li class="category" id="6">Sports Massage</li>
</div>
<div class="area" id="div_7">
<li class="category" id="7">Physiotherapy</li>
</div>
<div class="area" id="div_8">
<li class="category" id="8">Intensive Healing Pedicure</li>
</div>
<div class="area" id="div_9">
<li class="category" id="9">Pedicure Refresher</li>
</div>
<div class="area" id="div_10">
<li class="category" id="10">Therapeutic Pedicure</li>
</div>
</ul>
</div>
My CSS code is like below
.col-lg-4 > ul {
overflow-x: scroll;
width: 100%;
display:flex;
}
.category {
border:0;
padding: 0;
margin-right: 30px;
font-size: 15px;
}
I would like to put div side by side with full width of their content and some margin right side.
I am getting output like below
I need output text will be in one line.
"I need output text will be in one line." Here's everything in one line. Basically, all you needed was white-space: nowrap. I removed the extra HTML of the divs wrapping each li since that was invalid HTML and wasn't necessary. If you need divs, put them inside the lis. I'd make them spans though.
.col-lg-4>ul {
overflow-x: scroll;
width: 100%;
display: flex;
}
.category {
border: 0;
padding: 0;
margin-right: 30px;
font-size: 15px;
display: inline-block;
white-space: nowrap;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" />
<div class="col-lg-4">
<ul>
<li class="category" id="1">Hair</li>
<li class="category" id="3">Skin Care</li>
<li class="category" id="4">Makeup</li>
<li class="category" id="5">Body Treatments</li>
<li class="category" id="6">Sports Massage</li>
<li class="category" id="7">Physiotherapy</li>
<li class="category" id="8">Intensive Healing Pedicure</li>
<li class="category" id="9">Pedicure Refresher</li>
<li class="category" id="10">Therapeutic Pedicure</li>
</ul>
</div>
In a grid layout, content must be placed inside columns (.col and .col-*) and only columns may be the immediate children of rows (.row). Rows should be placed inside a .container or .container-fluid for proper padding and alignment.
<div class="container">
<!--Row with two equal columns-->
<div class="row">
<div class="col-md-6">Column left</div>
<div class="col-md-6">Column right</div>
</div>
</div>
The width of col-lg-4 is only 25% of the page. The text is getting cramped because of this. You can change it to col-lg-12 to occupy the whole page.
.col-lg-12>ul {
overflow-x: scroll;
width: 100%;
display: flex;
}
.category {
border: 0;
padding: 0;
margin-right: 30px;
font-size: 15px;
}
try this instead,
First of all remove all div inside the ,
Then,add this style,
.col-lg-4 > ul {
overflow-x: scroll;
white-space:nowrap;
margin:0;
}
.category {
margin-right: 30px;
font-size: 15px;
display:inline-block;
}
white-space:nowrap makes the inline. More info about white-space
All <li> makes inline by display:inline-bock. More info about display
.col-lg-4 > ul {
overflow-x: scroll;
white-space:nowrap;
margin:0;
}
.category {
margin-right: 30px;
font-size: 15px;
display:inline-block;
}
<div class="col-lg-4">
<ul>
<li class="category" id="1">Hair</li>
<li class="category" id="3">Skin Care</li>
<li class="category" id="4">Makeup</li>
<li class="category" id="5">Body Treatments</li>
<li class="category" id="6">Sports Massage</li>
<li class="category" id="7">Physiotherapy</li>
<li class="category" id="8">Intensive Healing Pedicure</li>
<li class="category" id="9">Pedicure Refresher</li>
<li class="category" id="10">Therapeutic Pedicure</li>
</ul>
</div>

Bootstrap 4 beta 2. How to make equal width li inside different col which are stretched to screen width?

I've spent much time, but can't get it work.
As you can see on fiddle, I have three main blocks (light gray), and multiple number of blocks inside. I need those little dark blocks to be equal width relatively to the width of the screen or to .thisBlock block (the same).
All divs are on their places. The markup is rather difficult, so I've leaved the most important blocks.
https://jsfiddle.net/nv5aznym/4/
<div class="row">
<div class="col-12">
<div class="row no-gutters">
<div class="col c">
<div class="block">
<ul class="ul d-flex justify-content-between">
<li class="d-inline-block">1</li>
<li class="d-inline-block">2</li>
</ul>
</div>
</div>
<div class="col c">
<div class="block">
<ul class="ul d-flex justify-content-between">
<li class="d-inline-block">11</li>
<li class="d-inline-block">22</li>
<li class="d-inline-block">33</li>
</ul>
</div>
</div>
<div class="col c">
<div class="block">
<ul class="ul d-flex justify-content-between">
<li class="d-inline-block">11</li>
<li class="d-inline-block">22</li>
<li class="d-inline-block">33</li>
<li class="d-inline-block">44</li>
</ul>
</div>
</div>
</div>
</div>
And CSS:
.c {
background-color: green;
margin: 0 2px;
color: white;
width: 100%;
}
.ul {
padding: 0;
margin: 0;
background-color: #dfe0e2;
padding: 5px;
}
.ul li {
background-color: #5d5d5d;
color: #919191;
cursor: default;
width: 100%;
margin: 0 2px;
}
use this jQuery code:
var totalLi = $('.thisBlock li').length;
$('.thisBlock .c').each(function(index, element){
var cLi = $(element).find('li').length;
$(element).css({'flex-basis':cLi/totalLi *100 +'%'})
})
https://jsfiddle.net/acLx1mod/

Overriding Bootstrap Container Full Width Background Color

I'm trying to have my container divs background color extend to the full width of the browser. Right now I am unable to bypass the container styling set up by default in bootstrap, despite adding my own class to the container. The only styling that works is the background-color. I have also tried the following CSS, but it didn't make any change.
margin-right: auto;
margin-left: auto;
padding-left: 0px;
padding-right: 0px;
background-color: #FDDC00;
Here is my HTML:
<div class="container selection-section">
<div class="row pattern-choice">
<div class="col-md-12">
<h2><i>Choose a pattern</i></h2>
<ul>
<li class="button-border">
<h3 class="button-choice" >SOLID</h3>
</li>
<li class="button-border">
<h3 class="button-choice" id="stripe-choice">STRIPE</h3>
</li>
<li class="button-border">
<h3 class="button-choice" id="plaid-choice">PLAID</h3>
</li>
</ul>
</div>
</div>
</div>
Here is my CSS:
.selection-section {
margin-right: auto;
margin-left: auto;
padding-left: 0px;
padding-right: 0px;
background-color: #FDDC00;
}
Use container-fluid instead of container if you want the container to extend to the full-width of your webpage.
If it's only the color that's a concern surrounding the container with another div might work for you.
.selection-section {
background: #FDDC00;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="selection-section">
<div class="container">
<div class="row pattern-choice">
<div class="col-md-12">
<h2><i>Choose a pattern</i></h2>
<ul>
<li class="button-border">
<h3 class="button-choice">SOLID</h3>
</li>
<li class="button-border">
<h3 class="button-choice" id="stripe-choice">STRIPE</h3>
</li>
<li class="button-border">
<h3 class="button-choice" id="plaid-choice">PLAID</h3>
</li>
</ul>
</div>
</div>
</div>
</div>
<hr>
<div class="container">
<div class="well">Outside Div</div>
</div>

Vertical alignment does not work in Bootstrap

I'm trying to vertically center the menu links of my header, but does not work. I'm using Bootstrap.
HTML
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 header">
<div class="row">
<div class="col-xs-1"></div>
<div class="col-xs-2" style="font-size: 40px;">
<p>Capelli</p>
</div>
<div class="col-xs-3"></div>
<div class="col-xs-6">
<ul class="list-group list-inline">
<li>Vestidos</li>
<li>Meus Pedidos</li>
<li></li>
<li></li>
<li>Login</li>
<li>Cadastro</li>
<li></li>
<li></li>
<li>Carrinho</li>
</ul>
</div>
<div class="col-xs-1"></div>
</div>
</div>
</div>
</div>
CSS
body {
background-color: #CFCFCF;
}
.header {
min-height: 3.7em;
color: #FFFFFF;
background-color: #002A43;
font-family: Arial, sans-serif;
font-size: 20px;
}
.vertical {
float: none;
display: inline-block;
vertical-align: middle;
}
When a run the code, nothing happens.
I've tried many things, like use the class directly in row or in col-, but nothing work. I also trie diferent methods to align vertically, but did not work.
P.S.: Sorry for my bad english.
You want to create a nav bar menu?
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">Capelli</a>
</div>
<div>
<ul class="nav navbar-nav push-right">
<li class="active">Vestidos</li>
<li> etc</li>
<li>etc</li>
<li>etc</li>
</ul>
</div>
</div>
</nav>
in css you shoud define the font-size of X pixels, because you are using relative font-size.
its 3.7em of 10px or 20px. depending the browser the value can change.
html{ font-size: 16px;}
.header{font-size: 1.25em; // 20/16 = 1.25 and you have sure the font size is relative to 16 because you have define html font size to 16px;.

Is there a way using **CSS only** (not JS) to hide an entire list item or div if a part of it is being cut off via overflow:hidden?

Firstly this question has been before (in a fashion) but without examples: Hiding an element completly that has had some overflow hidden
The Problem
I'm using the Gridster framework http://gridster.net/ to display some content and it uses a fixed height on each content area with overflow:hidden.
The content that I place in each content area could be 10 characters long or 100 characters (in a responsive framework) bootstrap and so can sometime get cut off.
Supporting Images
How it looks now
How I would like it to look
Example code
HTML
<div class="example_container">
<div class="WidgetContent pull-left">
<ul class="unstyled">
<li class="person ActivePerson">
<div class="StaffThumb pull-left">
<img src="https://cdn1.iconfinder.com/data/icons/dot/256/man_person_mens_room.png">
</div>
<div class="expert-details pull-left">
<ul class="innerBox unstyled">
<li>
James Harris
</li>
<li>Senior Management</li>
<li>London</li>
<li>VP, Marketing Communications</li>
</ul>
</div>
<div class="container-number pull-right">
<span class="label">76</span>
</div>
</li>
<li class="person ">
<div class="StaffThumb pull-left">
<img src="https://cdn1.iconfinder.com/data/icons/dot/256/man_person_mens_room.png">
</div>
<div class="expert-details pull-left">
<ul class="innerBox unstyled">
<li>
Carlos Fernandez
</li>
<li>Senior Management</li>
<li>Madrid</li>
<li>Senior Business Development Coordinator</li>
</ul>
</div>
<div class="container-number pull-right">
<span class="label">72</span>
</div>
</li>
<li class="person ">
<div class="StaffThumb pull-left">
<img src="https://cdn1.iconfinder.com/data/icons/dot/256/man_person_mens_room.png">
</div>
<div class="expert-details pull-left">
<ul class="innerBox unstyled">
<li>
Kate Evans
</li>
<li>Research</li>
<li>London</li>
<li>Communications Systems Analyst - Millar A/C Manager</li>
</ul>
</div>
<div class="container-number pull-right">
<span class="label">71</span>
</div>
</li>
<li class="person ">
<div class="StaffThumb pull-left">
<img src="https://cdn1.iconfinder.com/data/icons/dot/256/man_person_mens_room.png">
</div>
<div class="expert-details pull-left">
<ul class="innerBox unstyled">
<li>
Brian Montrose
</li>
<li>Business Development</li>
<li>New York</li>
<li>Business Development Analyst</li>
</ul>
</div>
<div class="container-number pull-right">
<span class="label">70</span>
</div>
</li>
<li class="person ">
<div class="StaffThumb pull-left">
<img src="https://cdn1.iconfinder.com/data/icons/dot/256/man_person_mens_room.png">
</div>
<div class="expert-details pull-left">
<ul class="innerBox unstyled">
<li>
Alison Roberts
</li>
<li>HR</li>
<li>San Francisco</li>
<li>HR - Pension</li>
</ul>
</div>
<div class="container-number pull-right">
<span class="label">68</span>
</div>
</li>
</ul>
</div></div>
CSS
.example_container { width:300px; height:325px; overflow:hidden; }
.WidgetContent {
width: 100%;
position: relative;
}
.pull-left {
float: left;
}
.pull-right {
float: left;
}
ul.unstyled, ol.unstyled {
list-style: none outside none;
margin-left: 0;
padding:0;
}
.ActivePerson {
background-color: #FCF8E3;
}
.person {
border-bottom: 1px dashed #E2E2E2;
display: block;
padding: 7px 50px;
}
li {
overflow: hidden;
}
.StaffThumb img {
border-radius: 3px;
height: 35px;
margin: 4px 10px 0 0;
width: 35px;
}
.StaffThumb {
left: 10px;
margin: 0;
position: absolute;
}
.container-number {
position: absolute;
right: 10px;
}
.ActivePerson .label {
background-color: #F89406;
}
.label {
font-size: 16px;
line-height: 20px;
margin: 0 5px;
position: relative;
top: 5px;
border-radius: 3px;
padding: 1px 4px 2px;
}
Example Fiddle
http://jsfiddle.net/3sTNL/
This little extra CSS: Uses flex layout
.WidgetContent {
height: 100%;
}
.WidgetContent > .unstyled {
margin: 0;
display: flex;
flex-direction: column;
flex-wrap: wrap;
float:left;
height: 100%;
}
.person {
position: relative;
}
fiddle here
YES!
Add column-width to the ul, equal to the container's width.
Add height to the ul, equal to the container's height minus padding/margin
Add break-inside:avoid (-webkit-column-break-inside) to the .people items
Result: http://jsfiddle.net/3sTNL/3/ (Tested in Chrome)
This is VERY haxy XD But it works!