Bootstrap different sizes inside same column - css

I'm trying to make a heading that attaches it self to my listview in bootstrap. However the heading does not extend as far as the listview, even though they are in the same column.
I want the title to extend as far as the list, there must be something I'm missing in the CSS.
My Code:
<div class="row">
<div class="col-sm-5 col-md-5 col-lg-5" style="margin-left:40px">
<div class="heading-surround-default-custom">
<div>
<asp:Label ID="LabelTitel" runat="server" CssClass="heading-default-custom" Text="Titel"></asp:Label>
</div>
</div>
<div class="list-group">
<asp:ListView ID="ListViewWebsite" runat="server" DataKeyNames="WebsiteID" ClientIDMode="AutoID">
<ItemTemplate>
<tr>
<td>
//List code
</td>
</tr>
</ItemTemplate>
</asp:ListView>
</div>
</div>
</div>
Custom CSS used in code:
.heading-default-custom {
color:#FFF;
margin-left: 10px;
font-weight:200;
font-weight:bold;
font-size:20px;
}
.heading-surround-default-custom {
background-color:#FF6600;
}
Sorry for mixing style, CSS and poor formatting. A result of repetitive trial and error. Pretty sure I'm missing something really simple.

You can use Bootstrap's built in panel classes to help you here (docs).
Bootply example: http://www.bootply.com/mT5mVxVpOT
HTML:
<div class="panel panel-custom">
<div class="panel-heading">
<h3 class="panel-title">Panel title</h3>
</div>
<div class="panel-body">
<ul class="list-unstyled">
<li>Panel content 1</li>
<li>Panel content 2</li>
<li>Panel content 3</li>
</ul>
</div>
</div>
Then add your CSS to tweak the colors etc.
.panel-custom .panel-heading {
color:#FFF;
font-weight:200;
font-weight:bold;
font-size:20px;
background-color:#FF6600;
border-radius: 0;
}
.panel-custom .panel-body{
background-color: #eee;
}

Related

Place a "col-lg-12" in a responsive container using

I am trying to place Bootstrap breadcrumb navigation in a template.
What I would like is a full-width 100% with a background color, and then within that place a col-lg-12 but I can't figure it out.
This image might help:
<div class="container-fluid darkgrey">
<div class="row">
<div class="col-lg-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">Home</li>
<li class="breadcrumb-item">Section</a></li>
<li class="breadcrumb-item active" aria-current="page"><?php the_title();?></li>
</ol>
</nav>
</div>
</div>
</div>
I think I might need to "nest" columns but I can't figure it out.
Am I on the right path? Thanks
Read the docs, Luke :-)
Use .container-fluid for a full width container, spanning the entire width of the viewport.
You are using .container-fluid, so you get a fluid, 100% width container. Use .container to get a fixed with container.
Here's a workig JSFiddle.
Also note you have an unbalanced </a> after Section, maybe just a copy-paste error here on SO.
To align the contents to .content width while keeping section background full-page width, you could nest a .container inside your .container-fluid:
.darkgrey {
background-color: #e9ecef;
}
.darkgrey .breadcrumb {
background-color: transparent;
margin-bottom: 0;
padding: .75rem 0;
}
.darkgrey + .container {
padding-top: .75rem;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid darkgrey">
<div class="container">
<div class="row">
<div class="col-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href>Home</a></li>
<li class="breadcrumb-item">Section</li>
<li class="breadcrumb-item active" aria-current="page">
Test Post 3
</li>
</ol>
</nav>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-12">
<h2>Test Post 3</h2>
<p> Lorem ipsum dolor sit amet... </p>
</div>
</div>
Important note: .containers can be placed inside .container-fluids but should not be placed inside another .container.
Another note: you probably don't need the CSS (from the screenshot it looks like your theme already handles that part, but I needed it on SO).

Selecting 2nd li of second occurrence of a class

I have
<ul class="biglist">
on many places of a page... in which i want to select only the second
<ul class="biglist">
and in that again select second li and add color to it...
i currently have it like follows
.biglist li:nth-child(2) {
color:#ff0000;
}
which i try to add...
.biglist:nth-child(2) li:nth-child(2)
it does not selects the second list's second item. Tried in internet search and could not able to get suitable solution. can someone help pls ?
Here is my complete code...
<div class="vc_col-sm-4 wpb_column column_container ">
<div class="wpb_wrapper">
<div class="dt-fancy-separator title-left accent-border-color" style="width: 100%;">
<div class="dt-fancy-title bg-on" style="color: #ffffff;">
<span class="separator-holder separator-left"></span>List of Places:
<span class="separator-holder separator-right"></span>
</div>
</div>
<div class="gap" style="line-height: 10px; height: 10px;"></div>
<section class="shortcode-teaser frame-fancy frame-on rotateInDownLeft animate-element">
<div class="shortcode-teaser-content text-big">
<ul class="biglist">
<li><p>New York</p></li>
<li><p>Ontario</p></li>
<li><p>London</p></li>
</ul>
</div>
</section>
<div class="gap" style="line-height: 30px; height: 30px;"></div>
</div>
</div>
<div class="vc_col-sm-4 wpb_column column_container ">
<div class="wpb_wrapper">
<div class="dt-fancy-separator title-left accent-border-color" style="width: 100%;">
<div class="dt-fancy-title bg-on" style="color: #ffffff;">
<span class="separator-holder separator-left"></span>List of Old Places:
<span class="separator-holder separator-right"></span>
</div>
</div>
<div class="gap" style="line-height: 10px; height: 10px;"></div>
<section class="shortcode-teaser frame-fancy frame-on rotateInDownLeft animate-element">
<div class="shortcode-teaser-content text-big">
<ul class="biglist">
<li><p>Mumbai</p></li>
<li><p>Tokyo</p></li>
<li><p>Bali</p></li>
</ul>
</div>
</section>
<div class="gap" style="line-height: 30px; height: 30px;"></div>
</div>
</div>
<div class="vc_col-sm-4 wpb_column column_container ">
<div class="wpb_wrapper">
<div class="dt-fancy-separator title-left accent-border-color" style="width: 100%;">
<div class="dt-fancy-title bg-on" style="color: #ffffff;">
<span class="separator-holder separator-left"></span>List of New Ones:
<span class="separator-holder separator-right"></span>
</div>
</div>
<div class="gap" style="line-height: 10px; height: 10px;"></div>
<section class="shortcode-teaser frame-fancy frame-on rotateInDownLeft animate-element">
<div class="shortcode-teaser-content text-big">
<ul class="biglist">
<li><p>Paris</p></li>
<li><p>Cairo</p></li>
<li><p>Delhi</p></li>
</ul>
</div>
</section>
<div class="gap" style="line-height: 30px; height: 30px;"></div>
</div>
</div>
My understanding is this is not possible in CSS using nth-child or nth-of-type.
The class check is done after the nth element check, so if there are other ul elements between those of class biglist, you have no guarantee of selecting the ul you are looking for.
You need a JavaScript based solution.
For example, using Jquery:
uls = $("ul");
var bigListCount = 0;
for(i = 0; i < uls.length; i++)
{
if($(uls[i]).hasClass("biglist")) bigListCount++;
if(bigListCount == 2){
$(uls[i]).css("color", "#ff0000");
}
}
You can try using :nth-of-type(N):
ul.biglist li:nth-of-type(2) { background-color: #ff0000; }
nth-of-type checks the occurrence of an item in its direct parent. In the case of your HTML, inside a div there is only one ul. So what you have to do is first select one of the top level elements (the column_container) and then set its ul's second li to red. Here you can see a working codepen example using your HTML.
https://codepen.io/tskjetne/pen/gWLKKr
For clarification, what I do is set the 2nd column_container's ul's 2nd li to color red.
Given the knowledge now that you have elements in between the ULs, css only will not work. Here's a jQuery solution:
if (($uls = $("ul.biglist")).length > 1){
$uls[1].find("li:nth-child(2)").css({ color: "#ff0000" })
}

How to change the color of a text inside li and make it override?

I have a newbie question; I have this code, using framework7.
<div class="list-block">
<ul>
<li>
<a href="" class="external item-content" >
<div id="div1" class="item-media" style="display:block" ><img ></div>
<div class="item-inner">
<div class="item-title-row">
<div class="item-title" ><></div>
</div>
<div class="item-subtitle"></div>
</div></a></li>
</ul>
</div>
The color of the item-title is blue. I want to make it red, bold and override any previous rule? I can't get it done, the CSS code included in the framework is too complicated for me.
i just added style="color: #FFFF00;"

Horizontally aligning two rows of divs

I have a couple rows of buttons, and I'd like one to be left aligned and the other right aligned -- but on a separate row.
If I were using tables this is how I'd do it:
<table>
<tr>
<td>Content Left Aligned</td>
</tr>
<tr>
<td align="right">Content Right Aligned</td>
</tr>
</table>
But I'm trying to use CSS and divs here. This is what I have: ( JSFiddle )
<div style='text-align:left;'>
<div class="btn1 rounded-corners">
Green
</div>
<div class="btn1 rounded-corners">
Blue
</div>
<div class="btn1 rounded-corners">
Purple
</div>
</div>
<div style="clear:all;"> </div>
<div style='text-align:right;'>
<div class="btn2 rounded-corners">
Six
</div>
<div class="btn2 rounded-corners">
Seven
</div>
<div class="btn2 rounded-corners">
Eight
</div>
</div>
<div style="clear:all;"> </div>
What am I doing wrong with this CSS? (see the JSFiddle for a working example of what's going on - there are some styles there that I didn't want to clutter up here)
Replace float:left with display:inline-block
Updated Fiddle
float is used for a very specific purpose. Placing <div>s on the same line is not it ;)
I agree with Pablo and would use CSS stylesheets rather than JS Fiddle
All you have to do is REMOVE the FLOAT properrty from your STYLES
And in place of DIVs use SPANs
No Other changes required!!
Copy and paste the code below into a NEW document and see.
.btn1
{
font-size:1.2em;
padding:5px 20px;
margin:0px 5px;
border: 1px solid #0E5727;
color:red;
cursor:pointer;
}
.btn2
{
font-size:.8em;
padding:5px 20px;
margin:0px 5px;
border: 1px solid #0E5727;
color:blue;
cursor:pointer;
}
.rounded-corners
{
-moz-border-radius: 20px; /* Firefox */
-webkit-border-radius: 20px; /* Safari, Chrome */
border-radius: 20px; /* universal */
}
<div style="text-align:left;">
<span class="btn1 rounded-corners">Green</span>
<span class="btn1 rounded-corners">Blue</span>
<span class="btn1 rounded-corners">Purple</span>
</div>
<div style="width: 100%;"> </div>
<div style="text-align:right;">
<span class="btn2 rounded-corners">Six</span>
<span class="btn2 rounded-corners">Seven</span>
<span class="btn2 rounded-corners">Eight</span>
</div>
<div style="width: 100%;"> </div>
You should use float property.
Would be something like this:
<div style="float:left;width:400px">
</div>
<div style="margin-left:400px">
</div>
Anyway you should use a css file appart.
Try it and tellme if it worked out.

<li> styling with css (chrome problems)

Hello I've got this weird problem with css.
I'm displaying an unordered list
<ul>
<li>
<div class='align-left'>
PMI
</div>
<div class='align-right'>
<img src="/img/delete_icon2.png" id='19' class="elim" name="19">
</div>
</li>
<li>
<div class='align-left'>
GRANDS COMPTES
</div>
<div class='align-right'>
<img src="/img/delete_icon2.png" id='21' class="elim" name="21">
</div>
</li>
<li>
<div class='align-left'>
associations
</div>
<div class='align-right'>
<img src="/img/delete_icon2.png" id='22' class="elim" name="22">
</div>
</li>
<li>
<div class='align-left'>
PME
</div>
<div class='align-right'>
<img src="/img/delete_icon2.png" id='25' class="elim" name="25">
</div>
</li>
<li>
<div class='align-left'>
ecoles privees
</div>
<div class='align-right'>
<img src="/img/delete_icon2.png" id='28' class="elim" name="28">
</div>
</li>
<li>
<div class='align-left'>
organisme
</div>
<div class='align-right'>
<img src="/img/delete_icon2.png" id='32' class="elim" name="32">
</div>
</li>
<li>
<div class='align-left'>
test
</div>
<div class='align-right'>
<img src="/img/delete_icon2.png" id='34' class="elim" name="34">
</div>
</li>
</ul>
now this is accompanied by these css rules:
.align-right{
float: right;
}
.align-left{
float: left;
}
On chrome, the bullet point from the list is actually UNDER the text for the bullet point.
Why did I do this, I want the images to be aligned from top down.
here are screenshots of the problem
thanks in advance.
the code you provided won't cause this problem.
Depending on what you want to do, adding
ul { list-style-type:none; }
or
ul li { padding-left:40px; }
may achieve desired effect.
edit
try adding overflow:hidden; to the li elements
I'd also personally do it like this:
li {
background:url(/img/delete_icon2.png) no-repeat center right;
padding-right:25px; /*might need to adjust */
}
<ul>
<li>PMI</li>
<li>Bla bla</li>
</ul>
no need to over-complicate things.
If you want the DIVS clickable you can just do
<li>PMI</li>
and CSS:
li a { display:block; width:xxx; height:xxx; }
as required.
Try playing with the list-style-position property. Options are inside and outside.
I had the same problem and it seems that you do not have exact control over the position of the default bullet point.
For me the following was working in Firefox and in IE, but in Chrome it is positioned inside the text:
<ul style="list-style-position: outside; margin:0; padding:0;">
<li />
<li />
</ul>
I needed to set margins and paddings for both the list and the list items to get the bullet point(disk) outside the text
<ul style="list-style-position: outside; margin:10px; padding:10px;">
<li style="padding: 10px 0 0 3px; margin-bottom: 8px;" />
<li style="padding: 10px 0 0 3px; margin-bottom: 8px;" />
</ul>
The strange part is, that if I set those bottom margins to anything less than 7 pixel, the bullets jump inside. 8px is the smallest working value, although there is lots of space around and between the elements (they move closer to each other fluently, only the bullet points start to jump).

Resources