i made a list of blocks using bootstrap 3.0. but im having problems with the desired outcome. Please help, thanks.
Current outcome
Desired outcome
Custom style from current outcome
.list_comments{
list-style: none;
margin-left:-40px;
}
.list-comment-block{
width:33.33%;
float:left;
padding:5px;
margin-bottom:-15px;
}
Markup
<ul class="list-comments">
<li class="list-comment-block">
<div class="thumbnail">
<div class="caption">
<i class="fa fa-comment fa-2x pull-right text-success"></i><h4>A student said</h4>
<i class="fa fa-quote-left fa-2x pull-left fa-border"></i>
<p>Use a few styles together and you'll have easy pull quotes or
a great introductory article icon.</p>
</div>
</div>
</li>
<li class="list-comment-block">
<div class="thumbnail">
<div class="caption">
<i class="fa fa-comment fa-2x pull-right text-success"></i><h4>A student said</h4>
<i class="fa fa-quote-left fa-2x pull-left fa-border"></i>
<p>Use a few styles together and you'll have easy pull quotes or
a great introductory article icon.</p>
</div>
</div>
</li>
<li class="list-comment-block">
<div class="thumbnail">
<div class="caption">
<i class="fa fa-comment fa-2x pull-right text-success"></i><h4>A student said</h4>
<i class="fa fa-quote-left fa-2x pull-left fa-border"></i>
<p>Use a few styles together and you'll have easy pull quotes or
a great introductory article icon.Use a few styles together and you'll have easy pull quotes or
a great introductory article icon.Use a few styles together and you'll have easy pull quotes or
a great introductory article icon.Use a few styles together and you'll have easy pull quotes or
a great introductory article icon.Use a few styles together and you'll have easy pull quotes or
a great introductory article icon.</p>
</div>
</div>
</li>
<li class="list-comment-block">
<div class="thumbnail">
<div class="caption">
<i class="fa fa-comment fa-2x pull-right text-success"></i><h4>A student said</h4>
<i class="fa fa-quote-left fa-2x pull-left fa-border"></i>
<p>Use a few styles together and you'll have easy pull quotes or
a great introductory article icon.</p>
</div>
</div>
</li>
</ul>
I have tried using position:relative, inherit too. I appreciate any answers
I think it would be easier to get the layout you want using DIV container elements instead of a UL. Then you can use CSS3 column-width to evenly align the thumbnails in a "masonry" style layout..
.list-comments {
-moz-column-width: 25em;
-webkit-column-width: 25em;
-moz-column-gap: .5em;
-webkit-column-gap: .5em;
}
.thumbnail {
display: inline-block;
margin: .5em;
padding: 0;
width:98%;
}
Demo: http://bootply.com/129218
Related
please help me i am writing html document and having a problem. can you tell why my footer is not increasing from its edges even if i select width 100% please help
this code is not compelte i have not given css please click link at bottom to see my problem
enter code <footer class="footer-distributed">
<div class="footer-left">
<img src="https://i.pinimg.com/originals/b7/b3/96/b7b396047648c1baa436937d0afdfa76.jpg">
<h3>About <span>just do it</span></h3>
<p class="footer-links">
Home
|
Blog
|
About
|
Contact
</p>
<hr>
<p class="footer-company-name">
copyright © 2021 kaustubh krishna</p>
</div>
<div class="footer-center">
<div>
<i class="fa fa-map-marker"></i>
<p><span>find about us at our social media</p>
<div>
<i class="fa fa-envelope"></i>
<p>support#justdoit.com</p>
</div>
</div>
<div class="footer-right">
<p class="footer-company-about">
<span>About the company</span>
We offer freelance services for you and your company </p>
</div>
<div class="footer-icons">
<i class="fa fa-facebook"></i>
<i class="fa fa-twitter"></i>
<i class="fa fa-instagram"></i>
<i class="fa fa-linkedin"></i>
<i class="fa fa-youtube"></i>
</div> here
link of document: https://codepen.io/kaustubh0711/pen/XWNdNrv?editors=1100
Your .small-container div has a max-width css style keeping it from taking up the entire width of the screen. You'll also have to remove the left and right padding from it or else you'll still have gaps on each side of your footer.
You have to close the .small-container and .row, they affect the footer.
<div class="small-container">
<div class="row">
... content ...
</div>
</div>
<!-----footer---->
I have 3 evenly sized columns within a bootstrap container class which I would like to display on the same row. (Until they all collapse simultaneously on a smaller screen) Currently, the first two columns align horizontally, but the third is positioned directly below the first. I have spent some time adjusting my CSS and html, but to no avail.
I've browsed for a relevant answer to my question, as I was sure this is quite a simple problem to fix, however I have not been able to find anything. Any solutions would be greatly appreciated.
(Bootstrap v4.4.1)
.cmsInterface {
background: yellow;
margin: 1em;
padding: 1em;
padding-top: 5em;
padding-bottom: 5em;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<div class="col-lg-4 cmsInterface" id="cms1" align="center">
<h5><i class="fas fa-chevron-right"></i> Create/Edit a News Article <i class="far fa-edit"></i></h5>
</div>
<div class="col-lg-4 cmsInterface" id="cms2" align="center">
<h5><i class="fas fa-chevron-right"></i> Create/Edit an Event <i class="far fa-calendar-times"></i></h5>
</div>
<div class="col-lg-4 cmsInterface" id="cms3" align="center">
<h5><i class="fas fa-chevron-right"></i> Add/Edit Staff <i class="fas fa-user-alt"></i></h5>
</div>
</div>
</div>
A screenshot of how the code currently looks in a browser:
columns in boostrap are supposed to stick to each others , to allow margin, you may only use .col without a number, and eventually add the -lg breakpoint:
example turning : <div class="col-lg-4 cmsInterface" id="cms2" align="center"> into <div class="col-lg cmsInterface" id="cms2" align="center">
.cmsInterface {
background: yellow;
margin: 1em;
padding: 1em;
padding-top: 5em;
padding-bottom: 5em;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
<div class="row">
<div class="col-lg cmsInterface" id="cms1" align="center">
<h5><i class="fas fa-chevron-right"></i> Create/Edit a News Article <i class="far fa-edit"></i></h5>
</div>
<div class="col-lg cmsInterface" id="cms2" align="center">
<h5><i class="fas fa-chevron-right"></i> Create/Edit an Event <i class="far fa-calendar-times"></i></h5>
</div>
<div class="col-lg cmsInterface" id="cms3" align="center">
<h5><i class="fas fa-chevron-right"></i> Add/Edit Staff <i class="fas fa-user-alt"></i></h5>
</div>
</div>
</div>
Demo : https://codepen.io/gc-nomade/pen/OJPrOqW
I have a few divs that act as lists/buttons on my page.
Each div contains an icon and a text.
I need to keep these 'buttons' in the center of the page but at the same time, I have to align the icons and texts under eachother.
So all the icons are under eachother AND all the texts are under eachother.
This is what I have so far:
code
https://jsfiddle.net/sy21m4dq/
.list{
width:100%;
text-align:center;
}
.list-item{
display:inline-block;
width:250px;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="list">
<div class="list-item">
<i class="fa fa-user" aria-hidden="true"></i> Account
</div>
<div class="list-item">
<i class="fa fa-sign-in" aria-hidden="true"></i> Account LOGIN
</div>
<div class="list-item">
<i class="fa fa-star" aria-hidden="true"></i> freedback
</div>
<div class="list-item">
<i class="fa fa-question" aria-hidden="true"></i> Help
</div>
</div>
This is what I am looking to achieve:
could someone please advice on this?
Thanks in advance.
I'd improve your markup structure and leverage a CSS layout option, such as display table, among others.
My suggestion is to have additional layers of markup for the various CSS layout concerns you have / need.
<div class="list">
<div class="list-container">
<div id="list-item">
<div class="list-item-cell"><i class="fa fa-user" aria-hidden="true"></i></div>
<div class="list-item-cell">Account</div>
</div>
<div id="list-item">
<div class="list-item-cell"><i class="fa fa-star" aria-hidden="true"></i></div>
<div class="list-item-cell">freedback</div>
</div>
<div id="list-item">
<div class="list-item-cell"><i class="fa fa-question" aria-hidden="true"></i></div>
<div class="list-item-cell">Help</div>
</div>
<div id="list-item">
<div class="list-item-cell"><i class="fa fa-sign-in" aria-hidden="true"></i></div>
<div class="list-item-cell">Account LOGIN</div>
</div>
</div>
</div>
In this way, you can leverage the type of layout styles you want in a cleaner fashion. Your markup is your skeleton. If you have too few bones, your design will be more limited.
.list{
width:100%;
text-align:center;
}
.list-container {
display: table;
max-width: 400px;
margin: 0 auto;
}
.list-item{
display: table-row;
width:250px;
}
.list-item-cell {
display: table-cell;
}
.list-item-cell:first-child {
padding-right: 10px;
width: 30px;
}
There's a few things going on that I will explain, but the below snippet works.
You had the divs with id="list-item", which was a typo. They needed to be class="list-item".
You had the .list-item as inline-block, but really they should be block, and the container (the .list div) should be set to the 250px width.
A little icing on the cake to make the icons / text really line up was to apply some width to the icons (.list-item .fa).
body{
text-align: center;
}
.list {
display: inline-block;
width: 150px;
}
.list-item {
display: block;
width: auto;
text-align: left;
}
.list-item .fa {
width: 30px;
text-align: center;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="list">
<div class="list-item">
<i class="fa fa-user" aria-hidden="true"></i> Account
</div>
<div class="list-item">
<i class="fa fa-sign-in" aria-hidden="true"></i> Account LOGIN
</div>
<div class="list-item">
<i class="fa fa-star" aria-hidden="true"></i> freedback
</div>
<div class="list-item">
<i class="fa fa-question" aria-hidden="true"></i> Help
</div>
</div>
Add a fixed width to the icons
i {
width: 20px;
text-align: center;
}
Make the list an inline-flex-container with columns-display
Center the whole box with either text-align-center or flex
https://jsfiddle.net/qw2f3ojt/
I was wondering why my buttons in the jsfiddle below and my line divider shown below in my jsfiddle isn't in line like my text on a mobile device such as the iPhone. For example, the outline of the buttons go each over each other and the line goes to the right side more and isn't equal on the users screen. How can I stop this from happening and ensure each part of the content on my web page is responsive/in proportion to what screen the user is viewing my site on.
Website code
Here is an example screenshot below of what I'm talking about.
As you can see in the code below, I have used bootstraps col could I have picked the wrong size of the container could this be the issue?
<div class="header1">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="header-content">
<h1 class="maintxt rotateInUpLeft animated">LIAM DOCHERTY</h1>
<h3 class="subtxt rotateInUpLeft animated">WEB DEVELOPER & GRAPHIC DESIGNER</h3>
<hr class="content-divider">
<ul class="list-inline intro-social-buttons">
<li>
<i class="fa fa-linkedin fa-fw"></i> <span class="network-name">Web Development Portfolio</span>
</li>
<li>
<i class="fa fa-linkedin fa-fw"></i> <span class="network-name">GFX Design Portfolio</span>
</li>
<li>
<i class="fa fa-linkedin fa-fw"></i> <span class="network-name">About Me</span>
</li>
<li>
<i class="fa fa-linkedin fa-fw"></i> <span class="network-name">Contact Me</span>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
You set a fixed width for hr class in CSS
.content-divider {
border-top: 1px solid #f8f8f8;
border-bottom: 1px solid rgba(0,0,0,0.2);
width: 790px;
}
This breaks the line divider on small screens.
For the buttons add a padding
ul.intro-social-buttons li {
padding-bottom: 10px;
}
https://jsfiddle.net/jktsmruc/3/
How can i remove this space between body and right side of page?
See full code here: https://jsfiddle.net/4tqdejyx/
<div class="social">
<h4 class="social-text">#Social</h4>
<ul class="lista">
<li><i class="fa fa-facebook-official" aria-hidden="true"></i></li>
<li><i class="fa fa-twitter" aria-hidden="true"></i></li>
<li><i class="fa fa-instagram" aria-hidden="true"></i></li>
<li><i class="fa fa-youtube-play" aria-hidden="true"></i></li>
<li><i class="fa fa-pinterest-p" aria-hidden="true"></i></li>
</ul>
</div>
<div class="Contact-us">
<div class="contact-button "> <p class="dugme"><button class="cbtn">Contact us</button></p></div>
</div>
<div class="footer">
<img src="" class="logo" alt="logo"/>
<h4 class="bk-text2">Buddy/Kitty</h4>
<p>©All rights reserved!</p>
</div>
Set the container's or body's width property to 100% to cover the complete width of the browser window. I could be more specific if you shower your code or made a JSFiddle.
The left class has a left-margin of 2%
The right class has a right-margin of 8%
I think that's where the problem lies and not with the body. Change your CSS for right to the following and it should fix the problem you're seeing.
.right {
margin-right: 2%;
margin-left: auto;
float: right;
}
Also...
It looked like you were having some problems with lining up your <div class="social"> correctly, so I made some changes to those tags. I also aligned your login button to hug to the right side to be symmetrical with the play button on the left.
https://jsfiddle.net/dotspencer/4tqdejyx/5/