I'm havent been front end coding for quite a while, havent been coding at all for quite a while. Now i'm trying some things again and i'm kinda stuck at something and hoping you folks could help me out :)
I've got a bootstrap row with nested divs. I want to center align the nested div's but can't seem to figure out how. Is there anyone able to push me in the right direction? My code is as follows:
<!--Features block Start-->
<div class="row">
<div id="features" class="col-sm-12">
<div class="row">
<div class="col-sm-3 features-content"><img class="center" src="img/icons/ssd.png" alt="ssd"><h3 class="center">SSD.</h3><p class="center">Placeholder text.</p></div>
<div class="col-sm-3 features-content"><img class="center" src="img/icons/network.png" alt="network"><h3 class="center">Network.</h3><p class="center">Place holder text</p></div>
<div class="col-sm-3 features-content"><img class="center" src="img/icons/database.png" alt="database"><h3 class="center">Database.</h3><p class="center">Placeholder text.</p></div>
</div>
<div class="row features-content">
<div class="col-sm-3 features-content"><img class="center" src="img/icons/opensource.png" alt="ssd"><h3 class="center">We <span class="glyphicon glyphicon-heart heart-color"></span> Open Source.</h3><p class="center">Placeholder text.</p></div>
<div class="col-sm-3 features-content"><img class="center" src="img/icons/cpanel.png" alt="network"><h3 class="center">CPanel.</h3><p class="center">Placeholder text.</p></div>
<div class="col-sm-3 features-content"><img class="center" src="img/icons/support.png" alt="database"><h3 class="center">24/7 Support.</h3><p class="center">Placeholder text.</p></div>
</div>
</div>
</div>
<!--Features block Stop-->
with the following CSS
#features{
background-color:#e1dbc5;
position: relative;
}
#features-content{
margin: 0 auto;
}
which results in: http://i.imgur.com/AhJKjkE.png
Anyone able to shed some light on this for me? If there is anything unclear or you need more information from me please ask!
Kind regards,
Arjen.
#features-content{
margin: 0 auto;
text-align:center;
}
#features{
background-color:#e1dbc5;
position: relative;
text-align:center;
}
text-align center on both ID's
actually it is much easier if you use the default grid for more nesting to get your design right
<div class="row">
<div id="features" class="col-sm-12" style="text-align:center;">
<div class="row">
<div class="col-sm-4 features-content">
<img class="center" src="img/icons/ssd.png" alt="ssd">
<h3 class="center">SSD.</h3>
<p class="center">Placeholder text.</p>
</div>
<div class="col-sm-4 features-content">
<img class="center" src="img/icons/network.png" alt="network">
<h3 class="center">Network.</h3>
<p class="center">Place holder text</p>
</div>
<div class="col-sm-4 features-content">
<img class="center" src="img/icons/database.png" alt="database">
<h3 class="center">Database.</h3>
<p class="center">Placeholder text.</p>
</div>
</div>
<div class="row features-content" style="text-align:center;">
<div class="col-sm-4 features-content">
<img class="center" src="img/icons/opensource.png" alt="ssd">
<h3 class="center">We <span class="glyphicon glyphicon-heart heart-color"></span> Open Source.</h3>
<p class="center">Placeholder text.</p>
</div>
<div class="col-sm-4 features-content">
<img class="center" src="img/icons/cpanel.png" alt="network">
<h3 class="center">CPanel.</h3>
<p class="center">Placeholder text.</p>
</div>
<div class="col-sm-4 features-content">
<img class="center" src="img/icons/support.png" alt="database">
<h3 class="center">24/7 Support.</h3>
<p class="center">Placeholder text.</p>
</div>
</div>
</div>
</div>
check this
Related
yall!
I want a direct link to one of these texts, but I can't figure it out. What would be a direct link to the second 'Michael Stewart':
<div class="content">
<section class="project-details">
<div class="container">
<div class="project-details-item">
<div class="row">
<div class="project-details-info wow fadeInLeft">
<h3 class="project-details-title">
Michael Stewart<br> Attorney
</h3>
</div>
<div class="project-details-img col-md-8 col-md-offset-4">
<img alt="" class="img-responsive" src="img/projects/1-780x668.jpg">
</div>
</div>
</div>
<div class="project-details-item">
<div class="row">
<div class="project-details-info wow fadeInRight">
<h3 class="project-details-title">
Michael Stewart<br> Attorney
</h3>
</div>
<div class="project-details-img col-md-8">
<img alt="" class="img-responsive" src="img/projects/1-780x668.jpg">
</div>
</div>
</div>
You would do the following:
Your content fits in the viewport height so it isn't going to jump unless you have more content with an overflow.
Whichever element you want to jump to, you must give it a specific ID which you can only use once, and use that #id as the target for the anchor
Jump to Michael
<div class="content">
<section class="project-details">
<div class="container">
<div class="project-details-item">
<div class="row">
<div class="project-details-info wow fadeInLeft" id>
<h3 class="project-details-title">
Michael Stewart<br> Attorney
</h3>
</div>
<div class="project-details-img col-md-8 col-md-offset-4">
<img alt="" class="img-responsive" src="img/projects/1-780x668.jpg">
</div>
</div>
</div>
<div class="project-details-item">
<div class="row">
<div class="project-details-info wow fadeInRight">
<h3 class="project-details-title" id="michealStew">
Michael Stewart<br> Attorney
</h3>
</div>
<div class="project-details-img col-md-8">
<img alt="" class="img-responsive" src="img/projects/1-780x668.jpg">
</div>
</div>
</div>
Im trying to get my "Jumbotron" centered at the top and beneath it have my picture to the left and carousel on the right.
Why does all my content float to the left? Im trying to get everything centered but cant quite make it work.
Im using Bootstrap 5, with flexbox
https://codepen.io/spacemonki87/pen/VwbvogM
HTML:
<section>
<div class="hero">
<div class="row" style="max-width: 1220px;">
<div class="content text-center">
<div class="value-prop text-center">
<h1 class="display-4">Hello, world!</h1>
<p class="lead">This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>
<hr class="my-4">
<p>It uses utility classes for typography and spacing to space content out within the larger container.</p>
<a class="btn btn-success btn-lg" href="#" role="button">Learn more</a>
</div>
<div class="hero-row d-flex">
<div class="hero-img-container d-flex text-center align-items-center" style="margin: 0 auto; width: 84%;">
<img style="max-width: 100%; height: auto;" src="../img/hp_hero_note#2x__en.png" height="800" />
</div>
<div class="carousel-container d-flex align-items-center" style="width: 16%; min-width: 240px;">
<div class="hero-carousel-texts slick-initialized slick-slider slick-dotted">
<div aria-live="polite" class="slick-list draggable">
<div class="slick-track">
<div class="hero-carousel-text slick-slide slick-cloned">
<div class="heading">
<p class="p-title hero-carousel-text-heading">FIND THINGS FAST</p>
</div>
<div class="description">
<p class="p-small">Get what you need, when you need it. Search gives you results as you type.</p>
</div>
</div>
<div class="hero-carousel-text slick-slide slick-cloned">
<div class="heading">
<p class="p-title hero-carousel-text-heading">FIND THINGS FAST</p>
</div>
<div class="description">
<p class="p-small">Get what you need, when you need it. Search gives you results as you type.</p>
</div>
</div>
<div class="hero-carousel-text slick-slide slick-cloned">
<div class="heading">
<p class="p-title hero-carousel-text-heading">FIND THINGS FAST</p>
</div>
<div class="description">
<p class="p-small">Get what you need, when you need it. Search gives you results as you type.</p>
</div>
</div>
<div class="hero-carousel-text slick-slide slick-cloned">
<div class="heading">
<p class="p-title hero-carousel-text-heading">FIND THINGS FAST</p>
</div>
<div class="description">
<p class="p-small">Get what you need, when you need it. Search gives you results as you type.</p>
</div>
</div>
<div class="hero-carousel-text slick-slide slick-cloned">
<div class="heading">
<p class="p-title hero-carousel-text-heading">FIND THINGS FAST</p>
</div>
<div class="description">
<p class="p-small">Get what you need, when you need it. Search gives you results as you type.</p>
</div>
</div>
<div class="hero-carousel-text slick-slide slick-cloned">
<div class="heading">
<p class="p-title hero-carousel-text-heading">FIND THINGS FAST</p>
</div>
<div class="description">
<p class="p-small">Get what you need, when you need it. Search gives you results as you type.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
Any tips on mastering layouts is greatly appreciated
You could just add mx-auto class to first child of div.hero. This will set margin-left and margin-right to auto, centering the contents of the page.
<section>
<div class="hero">
<div class="row mx-auto" style="max-width: 1220px;">
...
Try to add this style into .hero
display: flex;
justify-content: center;
I am trying to align three elements in a div in such a way that the image is inline with h1 while the p tag is beneath the h1 tag.
.valign{
position:relative;
top: 50%;
transform: translateY(-50%);
vertical-align: middle;
}
.banner{
position: relative;
height: 100vh;
width:100vw;
background: #eee;
}
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="banner" style="display:flex">
<div class="container">
<div class="valign">
<img src="img/logo.png" style="height: 150px;width: 150px">
<h1>Anirudh Sharma</h1>
<p>This is my portfolio</p>
</div>
</div>
</div>
</div>
</div>
Here is an image for reference:
This is how the elements must be arranged
This is how the elements are looking right now:
This is a screenshot of the webpage
Any help would be appreciated.
Try this
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="banner" style="display:flex">
<div class="container">
<div class="valign">
<div class="float-xs-left float-sm-left float-md-left">
<img src="img/logo.png"></div>
<div class="float-xs-left float-sm-left float-md-left">
<h1>Anirudh Sharma</h1>
<p>This is my portfolio</p></div>
</div>
</div>
</div>
</div>
</div>
the class value for float is based on bootstrap 4
Try this html
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="banner" style="display:flex">
<div class="container">
<div class="valign">
<div style="float:left">
<img src="img/logo.png" style="height: 150px;width: 150px"></div>
<div style="float:left">
<h1>Anirudh Sharma</h1>
<p>This is my portfolio</p></div>
</div>
</div>
</div>
</div>
</div>
Use floats, Bootstrap provides pull-left and pull-right helper classes, so use it on the two parts of your layout to have them side-by-by.
You need to add some margins here and there to make it look good.
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="banner" style="display:flex">
<div class="container">
<div class="valign">
<div class="row">
<div class="pull-left">
<img src="img/logo.png" style="height: 150px;width: 150px">
</div>
<div class="pull-left">
<h1>Anirudh Sharma</h1>
<p>This is my portfolio</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
https://jsfiddle.net/n8o1w3cq/
I have three different divs that should be displaying one after the other, but they just jump right up to each other on the webpage. Here is the code for all of them:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="top-section">
<center>
<div class="container" style="margin-top:150px;">
<div class="row">
<div class="top-title">
<h1>Introducing 10/40 Academy.</h1>
<h3>An affordable entrepreneurship course that can double as high school credit.</h3>
<img src="/Man_iPhone_Desk.jpg" style="height:300px;margin:30px;border-radius:4px;" class="raised hidden-xs" /><br>
Watch Video <span class="glyphicon glyphicon-play-circle"></span>
<h3 class="hidden-sm hidden-xs" style="letter-spacing:2px;margin-top:0px;">SCROLL DOWN</h3>
<h1 class="hidden-sm hidden-xs" style="font-weight:100;font-size:30px;"><span class="glyphicon glyphicon-chevron-down"></span></h1>
</div>
</div>
</div>
</center>
</div>
<div class="begin-tour">
<div class="container">
<div class="row">
<div class="col-md-6" style="margin-top:50px;">
<h2>Interested in small business?</h2>
<h2>We're here to help.</h2>
<p>
Paragraph
</p>
</div>
<div class="col-md-6">
<center>
<img width="70%" src="/MacImageBase.png" />
</center>
</div>
</div>
</div>
</div>
<div class="qualif">
<div class="container">
<div class="row">
<div class="col-md-6">
<h2>Header here</h2>
<h2>Header</h2>
<p>
some text
</p>
</div>
<div class="col-md-6"></div>
</div>
</div>
</div>
The best way to explain what happens is through a photo.
I've added the 3 divs into the bootstrap container, took out center(it is not used anymore or supported by HTML5), put each div as a 12 column row(col-md-12 class) so they show up one after the other like you wanted:
<div class="container">
<div class="row">
<div class="top-section col-md-12">
<div class="container" style="margin-top:150px;">
<div class="row">
<div class="top-title">
<h1>Introducing 10/40 Academy.</h1>
<h3>An affordable entrepreneurship course that can double as high school credit.</h3>
<img src="/Man_iPhone_Desk.jpg" style="height:300px;margin:30px;border-radius:4px;" class="raised hidden-xs" /><br>
Watch Video <span class="glyphicon glyphicon-play-circle"></span>
<h3 class="hidden-sm hidden-xs" style="letter-spacing:2px;margin-top:0px;">SCROLL DOWN</h3>
<h1 class="hidden-sm hidden-xs" style="font-weight:100;font-size:30px;"><span class="glyphicon glyphicon-chevron-down"></span></h1>
</div>
</div>
</div>
</div>
<div class="begin-tour col-md-12">
<div class="container">
<div class="row">
<div class="col-md-6" style="margin-top:50px;">
<h2>Interested in small business?</h2>
<h2>We're here to help.</h2>
<p>
Paragraph
</p>
</div>
<div class="col-md-6">
<center>
<img width="70%" src="/MacImageBase.png" />
</center>
</div>
</div>
</div>
</div>
<div class="qualif col-md-12">
<div class="container">
<div class="row">
<div class="col-md-6">
<h2>Header here</h2>
<h2>Header</h2>
<p>some text</p>
</div>
<div class="col-md-6"></div>
</div>
</div>
</div>
</div>
</div>
Here is the plunker so you can see it.
Please let me know if this helps. I didn't see your image until now so I hope it helps.
I'm experiencing a layout issue with my website (done using bootstrap 3)
For some reason the pictures alignment is messy (see pictures below)
Any idea what is wrong?
What I'd like:
What I have:
<section id="team">
<div class="row">
<div class="col-xs-2 col-sm-4">
<div class="team-member">
<div class="image" style="background-image:url(../images/male-employee.png)">
</div>
<p class="name">John Smith</p>
<p class="position">Fondateur
<br>Directeur Général</p>
</div>
</div>
<div class="col-xs-2 col-sm-4">
<div class="team-member">
<div class="image" style="background-image:url(../images/female-employee.png)">
</div>
<p class="name">John Smith</p>
<p class="position">Responsable diétéaires</p>
</div>
</div>
<div class="col-xs-2 col-sm-4">
<div class="team-member">
<div class="image" style="background-image:url(../images/female-employee.png)">
</div>
<p class="name">John Smithr</p>
<p class="position">Responsable dfsf, maux</p>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-2 col-sm-4">
<div class="team-member">
<div class="image" style="background-image:url(../images/male-employee.png)">
</div>
<p class="name">John Smith</p>
<p class="position">Responsable stome</p>
</div>
</div>
<div class="col-xs-2 col-sm-4">
<div class="team-member">
<div class="image" style="background-image:url(../images/female-employee.png)">
</div>
<p class="name">John Smith</p>
<p class="position">Responsable Facturation</p>
</div>
</div>
<div class="col-xs-2 col-sm-4">
<div class="team-member">
<div class="image" style="background-image:url(../images/male-employee.png)">
</div>
<p class="name">John Smith</p>
<p class="position">Technicien</p>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-2 col-sm-4 col-md-offset-2">
<div class="team-member">
<div class="image" style="background-image:url(../images/female-employee.png)">
</div>
<p class="name">John Smith</p>
<p class="position">Accueil Clients et Secrétariat</p>
</div>
</div>
<div class="col-xs-2 col-sm-4">
<div class="team-member">
<div class="image" style="background-image:url(../images/female-employee.png)">
</div>
<p class="name">John Smith</p>
<p class="position">Responsable administrative et assistante de Direction</p>
</div>
</div>
</div>
</section>
After each 3th div you could add this line to fix your height issue:
<div class="clearfix hidden-xs"></div>
Explanation:
The issue was occured by having divs with different heights. Since in bootstrap all col-* classes are floated, it's required to have some kind of clearfixing in similar cases to avoid misalignment. In this particular case the clearfix should not be applied to extra small screens because in that case there are 6 cols in a row instead of 3, so this is why i have used the hidden-xs class.
You need to add more rows in your divs. Right now the code isn't recognizing your columns in the code properly because it doesn't have anywhere to put them. I would edit your code for you but I'm on my phone.
Try putting a rowbefore the first member and ending row after the last member of the row and so on. Hope it helps.