I have a css class:
.content-shadow {
box-shadow: 0 0 5px #888888 !important;
}
I am using this class at to locations in the file:
<div class="root-content-padder">
<div class="container">
<h1><strong>"</strong>Die Freiarbeit ist nur das Ergebnis deiner Basis</h1>
<div class="content-shadow">
<div class="text-center st-padding">
<iframe style="width: 50vw; height: 430px"
src="youtube.com...."></iframe>
</div>
<div class="text-center st-padding">
<button class="btn btn-default btn-lg">Text</button>
<strong>Or</strong>
<button class="btn btn-default btn-lg">Text</button>
</div>
</div>
</div>
<div style="height: 25px;"></div>
<div class="container">
<div class="content-shadow">
<div class="col-lg-4">
<h1>LoL</h1>
</div>
<div class="col-lg-8">
<p>Text</p>
<br/>
<a class="btn btn-default btn-lg" href="?page=me">Weiter lesen</a>
</div>
</div>
</div>
</div>
Now the first div which has the class content-shadow works fine, without a problem, but on the second one the shadow does not appear.
I can make the shadow visible on the second, if i remove the two divs <div class="col-lg-4">...</div> and <div class="col-lg-8">...</div>
That is extremely strange and i have no idea why, maybe here someone can help.
Regards Liz3
If you remove any style from debugger tool, it means it comments your style at run time.
As you are using external style and if you remove it from debugger tool, it comments the styles written in content-shadow, so where ever you have used content-shadow doesn't work.
But if you use inline-style and apply box-shadow in two different div and then remove any one of the box-shadow from debugger tool, it just comment your internal-style of that particular div at run-time where as another one will work
So, it's a normal behaviour
Coming to your second point, col-lg-* removes box-shadow
It is working with col-lg-* also as you can see the snippet. But shadow at the bottom is not visible, to make it visible apply padding-bottom: 10px; in the parent element of content-shadow.
.content-shadow {
box-shadow: 0 0 10px darkgreen !important;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="root-content-padder">
<div class="container">
<h1><strong>"</strong>Die Freiarbeit ist nur das Ergebnis deiner Basis</h1>
<div class="content-shadow">
<div class="text-center st-padding">
<iframe style="width: 50vw; height: 230px" src="youtube.com...."></iframe>
</div>
<div class="text-center st-padding">
<button class="btn btn-default btn-lg">Text</button>
<strong>Or</strong>
<button class="btn btn-default btn-lg">Text</button>
</div>
</div>
</div>
<div style="height: 25px;"></div>
<div class="container" style="padding-bottom: 10px;">
<div class="content-shadow">
<div class="col-lg-4">
<h1>LoL</h1>
</div>
<div class="col-lg-8">
<p>Text</p>
<br/>
<a class="btn btn-default btn-lg" href="?page=me">Weiter lesen</a>
</div>
</div>
</div>
</div>
So the solution was pretty straight forward:
I had to put a <div style="clear: both;"></div> after the
<div class="col-lg-4">
<h1>LoL</h1>
</div>
<div class="col-lg-8">
<p>Text</p>
<br/>
<a class="btn btn-default btn-lg" href="?page=me">Weiter lesen</a>
</div>
Related
When I use display:block it doesn't want to work which was working before. When I inspect it shows me strike through on display:block. Now the buttons are positioned on the right side of the col, I'd need them to be positioned in the middle under the image.
html
<div class="sectionLight">
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-12 col-lg-4">
<img class="img-fluid imgCenter" src="images/square.png">
<div class="row">
<div class="col-sm-12">
<button type="button" class="btn btn-danger btn-lg btnCenter" data-toggle="modal" data-target=".square-modal-lg">Prime</button>
</div>
</div>
</div>
<div class="col-sm-12 col-lg-4">
<img class="img-fluid imgCenter" src="images/fibo.png">
<div class="row">
<div class="col-sm-12">
<button type="button" class="btn btn-danger btn-lg btnCenter" data-toggle="modal" data-target=".fibo-modal-lg">Fibo</button>
</div>
</div>
</div>
<div class="col-sm-12 col-lg-4">
<img class="img-fluid imgCenter" src="images/square_copy.png">
<div class="row">
<div class="col-sm-12">
<button type="button" class="btn btn-danger btn-lg btnCenter" data-toggle="modal" data-target=".prime-modal-lg">Square</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
CSS
.btnCenter {
display: block;
margin: auto;
margin-top: 15px;
margin-bottom: 20px;
width: 50%;
}
You probably have included another css script that overwrites your current one.
You can try to make it !important. If that doesnt work, you might have to make your selector more spesific than the one currently overwriting it.
.btnCenter {
display: block !important;
margin: auto;
margin-top: 15px;
margin-bottom: 20px;
width: 50%;
}
You can debug this in the dev-tools. See the example image below:
In this example, primary.css is higher in the css hierarchy (meaning the file primary.css is included later than stacks.css) Therefore, it will overwrite the selector.
I am trying to make three parallel square shape buttons with title in center. something like this
My title
Square button-1 square button-2 square button-3
My code is as follows::
<div class="col-md-12 pt-md-5 text-center">
<p>My title</p>
</div>
<div class="container">
<div class="row">
<div class="col-xs-4">
<div>
<button class="btn btn-sq-lg btn-info">button-1</button>
</div>
<div >
<button class="btn btn-sq-lg btn-info">button-2</button>
</div>
<div>
<button class="btn btn-sq-lg btn-info">button3</button>
</div>
</div>
</div>
</div>
.btn-sq-lg {
width: 150px !important;
height: 150px !important;
}
output I am getting is three vertical without any spaces. But I want three parallel square buttons with equal spaces
how can I do that?
Also how can I make button with white color and black text and title with white color and increase font size?
Just made button as info but want a white background with black text
col-xs-** has been replaced with col-** in v4. You need to separate each button with col-4
.btn-sq-lg {
width: 150px !important;
height: 150px !important;
background: #ffff!important;
color: black!important
}
.square {
text-align: center
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<p class="p-5 w-100 text-center">My title</p>
<div class="container">
<div class="row">
<div class="col-4">
<div class="square">
<button class="btn btn-sq-lg btn-info ">button-1</button>
</div>
</div>
<div class="col-4">
<div class="square">
<button class="btn btn-sq-lg btn-info">button-2</button>
</div>
</div>
<div class="col-4">
<div class="square">
<button class="btn btn-sq-lg btn-info">button3</button>
</div>
</div>
</div>
</div>
Use justify-content-between to row and remove the div with col-xs-4 (xs does not exist in bootstrap 4)
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<div class="col-md-12 pt-md-5 text-center">
<p>My title</p>
</div>
<div class="container">
<div class="row justify-content-between">
<div>
<button class="btn btn-sq-lg btn-info">button-1</button>
</div>
<div>
<button class="btn btn-sq-lg btn-info">button-2</button>
</div>
<div>
<button class="btn btn-sq-lg btn-info">button3</button>
</div>
</div>
</div>
If I enclose with a <div> with class="row" and give each button class="span4" the buttons fill the total width of the screen.
I want each button to be only as wide as the text which it contains, with the centers being at 25%, 50% and 75% of the width.
[aaa] [bbb] [ccc]
not
[ aaa ][ bbbb ][ cccc ]
I am new to bootstrap and not a CSS guru.
How do I achieve this?
My buttons also have class="btn-outline btn-default", but that shouldn't affect things (I think) .
By the way, I am currently considering exactly 3 buttons, but if a generic solution for any number is just as easy, that would be welcome.
first of all from your classes it seems you are still using bootstrap-v2, try using bootstrap-v3 (v4 it is still in alpha beta[now] stage), and you can achieve what you want with this:
.row {
border: 1px dashed red /* demo */
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row text-center">
<div class="col-xs-4">
<button type="button" class="btn btn-default">Left</button>
</div>
<div class="col-xs-4">
<button type="button" class="btn btn-default">Middle</button>
</div>
<div class="col-xs-4">
<button type="button" class="btn btn-default">Right</button>
</div>
</div>
</div>
UPDATE (bootstrap-v4)
For those who are using/want to use bootstrap V4, here is how:
.row {
border: 1px dashed red /* demo */
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row text-center">
<div class="col-4">
<button type="button" class="btn btn-default">Left</button>
</div>
<div class="col-4">
<button type="button" class="btn btn-default">Middle</button>
</div>
<div class="col-4">
<button type="button" class="btn btn-default">Right</button>
</div>
</div>
</div>
Try to use a div with class="row" and 3 div with the class="span4 text-center" and put a button in each of these
The bootstrap way would be
.col-md-3 {
text-align: center;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-sm-4"><button class="btn-outline btn-default">text</button></div>
<div class="col-sm-4"><button class="btn-outline btn-default">text</button></div>
<div class="col-sm-4"><button class="btn-outline btn-default">text</button></div>
</div>
</div>
or to do it using plain CSS and flexbox
.row {
display: flex;
}
.col-md-4 {
flex-grow: 1;
text-align: center;
}
<div class="container">
<div class="row">
<div class="col-md-4"><button class="btn-outline btn-default">text</button></div>
<div class="col-md-4"><button class="btn-outline btn-default">text</button></div>
<div class="col-md-4"><button class="btn-outline btn-default">text</button></div>
</div>
</div>
I am usually able to do this. But for some reason everything I've tried just isn't working.
I've tried
<div class="row">
<div class="col-md-8">
<button>Toronto</button>
<button>Markham</button>
<button>Petawawa</button>
</div>
<div class="col-md-4">
<p>date</p>
<p>date</p>
<p>date</p>
</div>
</div>
And similar variations, but I can't seem to get the date and the event location to line up.
The code where the issue is occuring:
<div id="Location">
<div class="container">
<div class="row">
<div class="col-md-6 col-xs-12 aboutCopyContainer">
<p class="copyHeader" style="font-family: testFont;">Locations</p>
<p class="faqContent">Fall for the FEAST at an event near you!</p>
<div class="row">
<div class="col-md-6">
<div class="btnLocationCont">
<button class="btn btn-primary btn-lg locationBtn locationButtonText" style="font-family: AvenirNextLTPro-Condensed;" onclick="window.location.href='http://convio.cancer.ca/site/PageNavigator/UFE_ON_Oktoberfeast_Toronto.html'">Toronto</button>
<div class="locationDateCont">
<p class="locatDay eventTimeBut">14</p>
<hr style="margin:0px;" />
<p class="locatMonth eventTimeBut">Oct</p>
</div>
</div>
</div>
<div class="col-md-6">
<div class="btnLocationCont">
<button class="btn btn-primary btn-lg locationBtn locationButtonText" style="font-family: AvenirNextLTPro-Condensed;" onclick="window.location.href='http://convio.cancer.ca/site/PageNavigator/UFE_ON_Oktoberfeast_Petawawa.html'">Petawawa</button>
<div class="locationDateCont">
<p class="locatDay eventTimeBut">7</p>
<hr style="margin:0px;"/>
<p class="locatMonth eventTimeBut">Oct</p>
</div>
</div>
<div class="btnLocationCont">
<button class="btn btn-primary btn-lg locationBtn locationButtonText" style="font-family: AvenirNextLTPro-Condensed;" onclick="window.location.href='http://convio.cancer.ca/site/PageNavigator/UFE_ON_Oktoberfeast_Markham.html'">Markham</button>
<div class="locationDateCont">
<p class="locatDay eventTimeBut">22</p>
<hr style="margin:0px;"/>
<p class="locatMonth eventTimeBut">Oct</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Here is the JS Fiddle of what's happening:
JSFiddle
and this is the website (under Locations section) to give you a better idea of what I'm trying to do (css styling etc applied).
Oktoberfeast Locations
Any suggestions are greatly appreciated! thank you for your time
You added fixed width inside bootstrap column child. And that width together with other element width exeeded bootsrap column width, so the class locationDateCont appeared underneath:
So, in your CSS file, remove that width from that class, and add this:
.btnLocationCont {
width: auto;
}
Hope this helps!
You probably don't want to do this that way. Reason being is on mobile devices they won't match up.
To keep them together and display on desktop and mobile you could do something like this:
<div class="row">
<div class="col-md-4">
<button>Toronto</button>
<p>date</p>
</div>
<div class="col-md-4">
<button>Markham</button>
<p>date</p>
</div>
<div class="col-md-4">
<button>Petawawa</button>
<p>date</p>
</div>
</div>
Fiddle:
https://jsfiddle.net/8t5mjhf8/4/
EDIT: To make sure the p's stay next to the buttons you need the following CSS. You will want to assign a class to the p's as to no interfere with other paragraphs.
p {
display: inline;
}
This is they layout of the page
Here's the code for this
<div class="newsContent row">
<div class="newsDate col-md-2">05 August 2014</div>
<div class="newsSeparator col-md-1">
</div>
<div class="newsDescription col-md-7">
<div class="row">
some dummy news
<div class="newsImage"><img alt="news2" src="/Images/News/news2.jpg">
</div>
</div>
</div>
<div class="newsActions col-md-2">
<div class="row">
<div class="col-md-4">
<button type="button" class="btn btn-default btn-lg edit-content" title="Edit the news" <span class="glyphicon glyphicon-pencil">
</span>
</button>
</div>
<div class="col-md-4">
<button type="button" class="btn btn-default btn-lg delete-content" title="Delete the news">
<span class="glyphicon glyphicon-trash"></span>
</button>
</div>
</div>
</div>
</div>
Now as you can see this green line is this part
<div class="newsSeparator col-md-1">
</div>
and the class is
.newsSeparator
{
background: url('my_1X1_pixel_image.png');
background-repeat: repeat-y;
}
But it is not repeating. I just see a 1px image instead of this desired green line. Something like this.
Why is it not repeating in y, after I've set background-repeat: repeat-y;. How do I make this like the desired line that repeats along y, and stretch/size accordingly as per the parent div and the news content?
EDIT
This is not a duplicate of that. I have background image that I need to repeat along y-axis.
You could wrap news description and image into a single <article> element
Then you may assign a border-left to the new inserted element. Doing so you avoid to use empty markup for styling purpose only and you also improve the semantic of the page.
<article>
<div class="newsDescription col-md-7">
<div class="row">
...
</div>
</div>
<div class="newsActions col-md-2">
<div class="row">
...
</div>
</div>
</article>
CSS
article {
border-left: 1px green solid;
padding-left: ... /* give some space between border and contents */
}
You can set height:inherit to set child div's height same as parent div.