Bootstrap Align ICON do not vertically center with Text - css

TL& DR: I am trying to make sure my left and right icons align with the center text which i have successfully been able to place directly in the CENTER of the screen.
As you can see below: If i put in a couple words or a small snippet block the left and right arrows do not look centered with the centered div.
Here are the thing I have tried unsuccessfully:
1) Tried to problematically do a count of the text and have it write a new style sheet each time. That just stinks and doesn't sound right? It didn't work anyway at least on ruby on rails. Level 10 stupid idea 5 hours wasted
2) I could require all TEXT in the WELL to be of a certain length but then that would put specific requirements coupled with the view Level 2 Stupid idea
3) Searched everywhere. As you can see, I was able to get the things centered on the screen, now its the small nuisances that are specific that a general tutorial or website can not teach.
<div class="container-fluid">
<div class="row">
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2">
<div class="pull-left centered_left">
<h1><span class="glyphicon glyphicon-menu-left "> </span> </h1>
</div>
</div>
<div class="col-xs-8 col-sm-8 col-md-8 col-lg-8">
<div class="centered well">
<h1 class="crop"> My ICONS do not align with this text!</h1>
</div>
</div>
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 ">
<div class="pull-right centered_right ">
<h1> <span class="glyphicon glyphicon-menu-right "> </span> </h1>
</div>
</div>
</div>
</div>
mysyle.css
.centered {
position: fixed;
top: 50%;
left: 50%;
/* bring your own prefixes */
transform: translate(-50%, -50%);
}
.centered_left {
position: fixed;
top: 49%;
left: 0%;
}
.centered_right {
position: fixed;
top:49%;
right: 0%;
}
h1.crop{
word-wrap: break-word;
-webkit-hyphens: auto;
-moz-hyphens: auto;
-ms-hyphens: auto;
-o-hyphens: auto;
hyphens: auto;
}
#media(max-width: 480px) {
h1 {
font-size: 12pt;
}
}

try changing your .centered_left, and .centered_right rules to this:
.centered_left {
position: fixed;
top: 50%;
left: 1%;
transform: translate(-50%, -50%);
}
.centered_right {
position: fixed;
top:50%;
right: -1%;
transform: translate(-50%, -50%);
}

Related

Extend Row Outside Container to View Port Width

Using Bootstrap 5, how I can extend a row to either be outside a container or appear to be outside the container and stretch to the viewport edge without a horizontal scrollbar.
Reviewing the questions related to this, I see the use of pseudo-elements. When I try to use a pseudo-element, a horizontal scrollbar appears, which is not the behavior I want. As stated in an answer below, I could use an overflow hidden on the body, but that isn't preferred since I feel that could cause styling issues elsewhere. Note that the example pen below is a very watered-down example.
CodePen showing an example of what I'm trying.
.full-width {
position: absolute;
}
.full-width:before {
left: -999em;
background: purple;
content: "";
display: block;
position: absolute;
width: 999em;
top: 0;
bottom: 0;
}
.full-width::after {
right: -999em;
background: purple;
content: "";
display: block;
position: absolute;
width: 999em;
top: 0;
bottom: 0;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container bg-dark vh-100">
<div class="row bg-light p-5">
<p class="text-dark">Hello World</p>
</div>
<div class="row full-width bg-info p-2">
<p>Just trying to extend to full width without horizonal scroll</p>
</div>
</div>
Edit:
I can accomplish what I'm looking for by separating the page at certain points with three containers. See this codepen for an example. This may be the approach I take, in my given situation. There are styling issues I'll need to take into account in the middle container, but could be accomplished fairly easily. If there's thoughts on a better way, please let me know.
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row bg-light p-5">
<div class="col">
<p class="text-dark">Hello World</p>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row bg-info p-2">
<div class="col">
<p>Just trying to extend to full width without horizonal scroll</p>
</div>
</div>
</div>
<div class="container">
<div class="row bg-light p-5">
<div class="col">
<p>More content here</p>
</div>
</div>
</div>
First of all you need overflow:hidden on the body. Secondly, content doesn't go directly in the row. Instead content should be placed inside a column (col) inside the row. Then make the col full-width...
https://codeply.com/p/krYOqrcJlR
<div class="container bg-dark vh-100">
<div class="row bg-light">
<div class="col">
<p class="text-dark">Hello World</p>
</div>
</div>
<div class="row bg-info">
<div class="col full-width">
<p>Just trying to extend to full width without horizonal scroll</p>
</div>
</div>
</div>
body {
overflow:hidden;
}
.full-width {
position: relative;
}
.full-width:before {
left: -999em;
background: purple;
content: "";
display: block;
position: absolute;
width: 999em;
top: 0;
bottom: 0;
}
.full-width::after {
right: -999em;
background: purple;
content: "";
display: block;
position: absolute;
width: 999em;
top: 0;
bottom: 0;
}

Can I change CSS stacking on overflow to move upwards?

I have in my page the following section:
Screenshot of the bottom of my page
Basically i have a fixed div with some buttons that we show on the bottom of the page. The thing is, sometimes we include only one button, sometimes we include four or five. When you resize the page, the buttons get pushed down, this is the normal behaviour I guess:
What happens when I resize
I was wondering, is it possible to reverse the direction the buttons are being pushed towards? As in, force the div to take more space above itself, and not downwards, therefore keeping the buttons visible?
Our fixed element has the following CSS, in case it is useful
.actions_fixbar {
position: fixed;
bottom: 0px;
right: 0px;
width: 100%;
z-index: 9;
background: #fff;
height: 50px;
box-shadow: 0px 0px 5px 0px #ddd;
}
Remove height attribute.
let a = 1;
function addButton() {
$('#footer').append('<button>Button '+ ++a+'</button>');
}
#footer {
position: fixed;
width: 100%;
bottom: 0;
background: #c4c4c4;
}
button {
width: 50%;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button onclick="addButton()">Add more button</button>
<div id="footer">
<button>Button 1</button>
</div>
Try this with bootstrap.The buttons are just placeholders for a quick demo.Replace them with your actual elements
<style>
footer{
position: fixed;
bottom: 0;
width: 100vw;
}
</style>
<footer>
<div class="container">
<div class="row ">
<div class="col">
<button>Back</button>
</div>
<div class="col">
<button>Submit</button>
</div>
<div class="col">
<button>Request to update</button>
</div>
<div class="col">
<button>Export by default</button>
</div>
</div>
</div>
</footer>

(foundation) grid cell breakout with background image

I'm using foundation for my grid system but this could be a problem in any grid system. I got basicly 3 cells wrapped by one container but one of the cells should grow to the page border (left in my Sampe-Image
but this also could be on the right side).
when I define a fixed width like in this fiddle, it works, but the background image too wide, I need a responsive version :-/
HTML:
<div class="grid-container">
<div class="grid-x grid-margin-x">
<div class="large-4 cell">
<div class="specialdiv"></div>
</div>
<div class="large-4 cell">
<p>test</p>
</div>
<div class="large-4 cell">
<p>test</p>
</div>
</div>
</div>
CSS:
.specialdiv {
position: relative;
border: 1px solid red;
height: 100%;
}
.specialdiv:after {
content: "";
display: block;
top: 0;
right: 0;
height: 100%;
position: absolute;
width: 2000px;
background: url("https://images.pexels.com/photos/531880/pexels-photo-531880.jpeg");
background-size: cover;
}
https://codepen.io/anon/pen/ZjeBOz
Any hints?
Im not sure what exactly you want, but if the goal is to keep the image in the cell with no regards to cropping you can just apply overflow-x: hidden; to .specialdiv

CSS Particles Js Overlap Issue

Here is the repository for my personal website: https://github.com/flakpanzer40/flakpanzer40.github.io
As you may notice, the particles I've used are simply showing below my name, image, and description. I've tried numerous times to overlap them so that the particles happen in the back, but to no avail. I've tried absolute positions, z-index, re-arranging the DIVs, etc. I'm terrible at CSS.
Can anyone help?
Please add following styles:
.container {
/*other css*/
position: relative;
z-index: 1;
}
.particles-js-canvas-el {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 0;
}
Use the following Code:
HTML:
<div id="particles-js" style="">
<canvas class="particles-js-canvas-el" width="1903" height="952" style="width: 100%;height: 100%;position: absolute;top: 0;left: 0;"></canvas>
<div class="container">
<div class="row">
<div class="col-lg-12">
<img class="img-responsive" src="img/EvanRen.jpg" alt="Evan Ren" style="width:500px;height:600px;border:5px solid white;border-radius: 50%;">
<div class="intro-text">
<span class="name">University of Waterloo Computer Science</span>
<hr class="star-light">
<span class="skills">Problem_solving expert - Hardworking - Passionate</span>
</div>
</div>
</div>
</div>
</div>
CSS:
#particles-js {
width: 100%;
height: 100%;
background-color: #13717c;
position: relative;
top: 0;
}
It is important that the parent (#particles-js) has position: relative so that you can use absolute positioning for the children.

Centering text any screen size

Can someone help me to center my text using javascript or in css?
I'm using bootstrap on this.
This is my html code
<header id="home">
<div class="container">
<div class="row banner" style="margin-top: 0px;">
<div class="banner-text">
<h1 class="responsive-headline wow zoomIn animated" style="font-size: 72px; visibility: visible; animation-name: zoomIn;">I'm <span>Alyssa Reyes</span></h1>
<h3 class="wow fadeInUp animated" style="visibility: visible; animation-name: fadeInUp;">I'm a passionate <span>Web Designer</span> and <span>Developer</span> creating modern and responsive design for <span>Web</span> and <span>Mobile</span>. <br> Let's start and learn more about me.</h3>
<hr>
</div>
</div>
</div>
</header>
Thanks
You can use text-align property
<h1>Alyssa Reyes</h1>
css
h1{
text-align:center;
}
Demo of your page
if you want to center vertically, you can use
.banner-text {
position: absolute;
top: 50%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%) }
demo

Resources