Okay, so I'm building a layout in bootstrap + Rails.
If I upload a larger picture the footer does not clash with the text box with the content information but with the picture I am using there are issues.
what can I do to use the elements(pictures) I like and ensure that the footer never collides with the textbox?
the view looks like this
`<h1>Contact#index</h1>
<p>Find me in app/views/contact/index.html.erb</p>
<div class="container">
<div class="content-overlap">
<h2>Contact Us</h2>
<p> For investment information call: <br>
+phonenumberhere237 or +phonenumberhere8 <br> <br>
For legal contact:+phonenumberhere0 <br>
For partnership: phonenumberhere7142 <br>
</p>
</div>
<div class="image-overlap">
<img src="assets\administration.jpg" >
</div>
</div>`
Using bootstrap and rails 5.1.4 (but it turns out the code comes from a codepen not bootstrap so ignore that forked code is here https://codepen.io/Anthematics/pen/RMwZJG)
The footer itself renders as a partial in my layouts folder - this issue persists in a few places but this has the least elements and once solved here I am sure I can solve elsewhere.
in HTML my footer looks like this <p class = "footie"> Victoria University 2018 </p>
in css
.footie {
&:before {
display: block;
content: " ";
clear: both;
}
}
.footie {
background: black;
color: wheat;
}
Using clearfix where needed ? https://v4-alpha.getbootstrap.com/utilities/clearfix/
Or your could try :
footer {
&:before {
display: block;
content: " ";
clear: both;
}
}
Taking your code :
<div class="container">
<div class="content-overlap">...</div>
<div class="image-overlap">...</div>
</div>
<div style='display: block; clear: both;'></div>
Related
This question already has answers here:
CSS 3 nth of type restricted to class [duplicate]
(2 answers)
Closed 1 year ago.
I'm been working on finding a way to change my even and odd setup so it relies more on the classes instead of the html strucktur but am at a complet loss.
The setup i but below works but if there's too much change to the HTML it would likely break.
(The HTML images gives a simpel overview)
The collapsed HTML version shows 3 div's but the 2 div is actually a set of 2.
The classes it goes like this:
academy-subject-block
academy-column-block
academy-column-block
academy-subject-block
The end result is 4 squares where the first one keeps it's image from what it had on tablet size screens and above.
The next 3 will alternate between a white and a light grey bagground-color without the images.
HTML from browser view:
HTML Viewed from browser
HTML Viewed from browser collapsed
HTML:
<div class="container academy ">
<div class="academy-front-page">
<div class="fullPageAdjustment">
#Html.PropertyFor(m => m.CurrentPage.ContentArea)
</div>
</div>
</div>
-------------------------------------------------------------
<div class="academy-subject-block">
<div class="row">
<div class="col-xs-12">
<div class="img-fullwidth cover-image">
<img src="#Url.ContentUrl(Model.CoverImage)" alt="Cover Image" class="fill-height-image min-height"/>
<div class="cta-turquiose-centerallign-mobile">
<a href="#Url.ContentUrl(Model.ButtonLink)" class="pulse animated btn bta-cta-turkuoise">
#Html.PropertyFor(l => l.ButtonText)
</a>
</div>
</div>
</div>
</div>
<div class="text-block-image fadeIn animated">
#Html.PropertyFor(m => m.OverlayText)
</div>
</div>
-------------------------------------------------------------
<div class="academy-column-block ">
<div class="img-fullwidth cover-image">
<img src="#Url.ContentUrl(Model.CoverImage)" alt="Cover Image" class="fill-height-img min-height"/>
<div class="cta-turquiose-centerallign">
<a href="#Url.ContentUrl(Model.ButtonLink)" class="pulse animated btn bta-cta-turkuoise">
#Html.PropertyFor(l => l.ButtonText)
</a>
</div>
</div>
<div class="text-block-image-column-block fadeIn animated">
#Html.PropertyFor(m => m.OverlayText)
</div>
</div>
SCSS:
//Pulls the section up and down as to remove any spacing
.academy-front-page {
.fullPageAdjustment {
#include mobile {
position: relative;
margin-top: -80px;
bottom: -40px;
}
}
//Removes images but keeps the size without effecting the fist image
//And adds new text color to images that have changed
:not(:first-child) {
#include mobile {
img {
width: 0;
}
.text-block-image-column-block {
color: #{$Color-DarkPurple};
}
.text-block-image {
color: #{$Color-DarkPurple};
}
}
}
//Switches between background-colors of the images with exception of the fist one (Mobile only)
div :nth-child(odd) {
#include mobile {
.img-fullwidth {
background-color: #{$Color-White};
}
.hidden-print {
.img-fullwidth {
background-color: #{$Color-WhiteSmoke};
}
}
}
}
:nth-child(even) {
#include mobile {
.img-fullwidth {
background-color: #{$Color-White};
}
.hidden-print {
.img-fullwidth {
background-color: #{$Color-WhiteSmoke};
}
}
}
}
}
Afaik, this is currently not possible with CSS alone.
You would have to:
use Javascript to implement that CSS class based or
go with the CSS pseudo classes :nth-of-type or :nth-child depending on HTML elements.
I have a dynamic page that displays multiple pages and has a class that starts with 'paged-' and the number of that page. I want to remove a div with SASS when it's on the page 2 and beyond like this:
.paged-2, .paged-3, .paged-4, .paged-5, .paged-100{
.removeonpagetwoandso{
display: none;
}
}
But I don't want to write from paged-2 to paged-100 since I don't know how many pages it will have in the future.
This doesn't work:
div[class^='paged'], div[class*='paged-']{
.removeonpagetwoandso{
display: none;
}
}
EDIT: Added HTML Structure
Page 1:
<body class="home">
<div class="removeonpagetwoandso">Home Page 1 Only</div>
</body>
Page 2 and so:
<body class="home paged-2">
<div class="removeonpagetwoandso">Home Page 1 Only</div>
</body>
SASS compile
div[class^='paged'],
div[class*='paged-']{
.removeonpagetwoandso{
display: none;
}
}
to
div[class^=paged] .removeonpagetwoandso,
div[class*=paged-] .removeonpagetwoandso {
display: none;
}
In your case
div[class^='paged-'] {
.removeonpagetwoandso {
display: none;
}
}
is enough. It is compiled to
div[class^=paged-] .removeonpagetwoandso {
display: none;
}
which means
child element having removeonpagetwoandso class of elements whose class starts with paged-. I think you have problem with your html structure. You HTML must look like as follows:
<div class="paged-1">
<div class="removeonpagetwoandso">
paged-1
</div>
</div>
<div class="paged-2">
<div class="removeonpagetwoandso">
paged-2
</div>
</div>
<div class="paged-3">
<div class="removeonpagetwoandso">
paged-3
</div>
</div>
<div class="paged-4">
<div class="removeonpagetwoandso">
paged-4
</div>
</div>
<div class="paged-5">
<div class="removeonpagetwoandso">
paged-5
</div>
</div>
<div class="paged-100">
<div class="removeonpagetwoandso">
paged-100
</div>
</div>
pls try this css
<style>
div[class^="paged-"]{
.removeonpagetwoandso{
display: none;
}
}
</style>
I have 6 buttons which I would like to place underneath each other with spaces in between them but it seems to not be working.
this is my view:
<div id="btnline1">
Create an Order
</div>
<div id="btnline2">
Mangage Orders
</div>
<div id="btnline3">
Manage Drivers
</div>
<div id="btnline4">
Manage Equipments
</div>
<div id="btnline5">
Manage Customers
</div>
<div id="btnline6">
Reports
</div>
and this is my css:
#btnline1,
#btnline2
#btnline3,
#btnline4,
#btnline5,
#btnline6
{
float: right;
margin-bottom: 10px;
}
here is an image of what it looks like:
You're missing a comma after #btnline2:
#btnline1,
#btnline2
#btnline3,
Fix that, and add clear: both to the styles to force them to separate lines:
#btnline1,
#btnline2,
#btnline3,
#btnline4,
#btnline5,
#btnline6
{
float: right;
margin-bottom: 10px;
clear: both; //add this
}
Fiddle
I'm not too sure if this has been answered elsewhere, but I've been having some trouble with coding in Adobe Dreamweaver CS6, I've made a spry collapsible panel with the following code:
<div id="CollapsiblePanel1" class="CollapsiblePanel">
<div class="CollapsiblePanelTab" tabindex="0">Bosses<span style="text-align=right"> Show</span></div>
<div class="CollapsiblePanelContent"><div>Asylum Demon</div><!--Welcome to dark souls-->
<div>Taurus Demon</div>
<div>Belfry Gargoyles</div>
<div>Capra Demon</div>
<div>Gaping Dragon</div>
<div>Chaos Witch Quelaag</div>
<div>Iron Golem</div>
<div>Crossbreed Pricilla</div><!--praise the fluffy tail-->
<div>Ornstein & Smough</div>
<div>Great Grey Wolf Sif</div><!--such boss, very sword, wow-->
<div>Moonlight Butterfly</div><!--Dark Souls: Easy Mode-->
<div>Seath the Scaleless</div><!--bury face in crotch and stab-->
<div>The Four Kings</div><!--more like 3 kings-->
<div>Ceaseless Discharge</div>
<div>Demon Firesage</div>
<div>Centipede Demon</div>
<div>Bed of Chaos</div><!--SCREW THIS BOSS-->
<div>Stray Demon</div>
<div>Pinwheel</div>
<div>Gravelord Nito</div>
<div>Gwyn Lord of Cinder</div></div>
</div>
<script type="text/javascript">
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel1");
</script>
My question is; how can I get the < span style'text-align=right">Show< /span> bit to align right without affecting the "Bosses" text?
<style>
.CollapsiblePanelTab .left {
float: left;
}
.CollapsiblePanelTab .right {
float: right;
}
</style>
<div class="CollapsiblePanelTab" tabindex="0">
<span class="left">Bosses</span>
<span class="right">Show</span>
</div>
http://jsfiddle.net/96up8/
Or even shorter:
<style>
.CollapsiblePanelTab .right {
float: right;
}
</style>
<div class="CollapsiblePanelTab" tabindex="0">
Bosses <span class="right">Show</span>
</div>
http://jsfiddle.net/96up8/1/
Trying to figure out how to do this. I have the style but I'd like something to happen after I click the tabs. I would like the div with the tab class names to show and hide when i click the tabs. I'm assuming how that would work. Right now when I click the tabs nothing happens.
Here's my HTML
<style type="text/css">
ul.tabs {
display: table;
list-style-type: none;
margin: 0;
padding: 0;
}
ul.tabs>li {
float: left;
padding: 10px;
background-color: lightgray;
}
ul.tabs>li:hover {
background-color: lightgray;
}
ul.tabs>li.selected {
background-color: lightgray;
}
div.content {
border: 1px solid black;
}
ul { overflow: auto; }
div.content { clear: both; }
</style>
<body>
<ul class="tabs">
<li>Description</li>
<li>Specs</li>
</ul>
<div class="pane">
<div class="tab1">
<div><h2>Hello</h2></div>
<div />
<div>Hello hello hello.</div>
<div />
<div>Goodbye goodbye, goodbye</div>
<div />
<div />
</div>
<div class="tab2" style="display:none;">
<div><h2>Hello2</h2></div>
<div />
<div>Hello2 hello2 hello2.</div>
<div />
<div>Goodbye2 goodbye2, goodbye2</div>
<div />
</div>
</div>
<div class="content">
This should really appear on a new line.
</div>
</body>
Standard answer: you can't. There is no way to do this with purely HTML/CSS2, unfortunately. We can make drop-downs in CSS with the :hover psuedo-class, but there's no equivalent for clicks. Look into one of these Javascript-based solutions.
Secret answer: CSS3 [kind of] supports this. But you have to create radio buttons [weird], and it's not supported in IE7/8. If you dare...
And if you don't mind using Javascript, here's a quick solution. Reformatted your HTML, first of all. No need to put <h2>s in <div>s, and use <br /> for breaks—that's what it's there for. Also, I changed the tab <div>s to use id's instead of classes. If you have unique identifiers for an element, use id.
<ul class="tabs">
<li>Description</li>
<li>Specs</li>
</ul>
<div class="pane">
<div id="tab1">
<h2>Hello</h2>
<p>Hello hello hello.</p>
<p>Goodbye goodbye, goodbye</p>
</div>
<div id="tab2" style="display:none;">
<h2>Hello2</h2>
<p>Hello2 hello2 hello2.</p>
<p>Goodbye2 goodbye2, goodbye2</p>
</div>
</div>
<div class="content">This should really appear on a new line.</div>
Didn't touch your CSS.
For Javascript, I recommend using jQuery. It really simplifies things.
All you need are these lines of code:
$(document).ready(function() {
$("ul.tabs a").click(function() {
$(".pane div").hide();
$($(this).attr("href")).show();
});
})
Basically, once the page is ready [has loaded], look for every link that's a child of a tabs ul. Attach a function that runs each time this link is clicked. When said link is clicked, hide all the tabs in the .pane div. Then, use the link's href to find the proper tab div and show it.
fiddle: http://jsfiddle.net/uFALn/18/
Because of the floated <li> elements your <ul> element is zero height.
Try adding ul { overflow: auto; } and div.content { clear: both; } to your CSS
Thanks benesch. It helped me too.
One can also add return false to prevent that jerky jump to the anchor. For instance:
$("ul.tabs a").click(function() {
$(".pane div").hide();
$($(this).attr("href")).show();
return false;
});