I need to style those elements from gentelella template:
https://colorlib.com/polygon/gentelella/contacts.html
and this is my implementation
<div class="col-md-4 col-sm-4 col-xs-12 profile_details">
<div class="well profile_view">
<div class="col-sm-12 col-xs-12">
<div class="crop col-md-4 col-sm-12 col-xs-12 text-center ">
<img src= "https://media-cdn.tripadvisor.com/media/photo-s/0d/bf/07/9b/post-card-view.jpg" alt="" class="img-icon-template img-fluid ">
</div>
<div class=" col-md-8 col-sm-8 col-xs-12">
<div class="">
<h4 class="brief titolo_template"><i>TITLE</i></h4>
<div><i class="fa fa-user"><strong> user XXX </i> </div>
<p class="descr_p"><i class="fa fa-file-text-o"> <strong> descr: </strong> </i>something</p>
</div>
</div>
</div>
<div class="col-xs-12 bottom text-center">
<div class="col-xs-12 col-sm-12 emphasis text-left">
<p class="">
<a>relase date </a><i>dd/mm/aaaaa #endif</i>
</p>
<div class="col-md-6 col-sm6">
<a class="btn-block btn-success btn-xs text-center"
role="button" id="btnT2"
href="/templateGraphic/idxxx"
<i class="fa fa-sort-amount-asc "></i>view tamplate
</a>
</div>
<div class="col-md-6 col-sm-6">
<a class="btn-block btn-info btn-xs text-center"
role="button" id="btnT1"
href="alo/oo"
class="btn btn-info btn-xs">
<i class="fa fa-comments-o"></i> get replies
</a>
</div>
</div>
</div>
</div>
</div>
as you can see there are no fixed height, and if there is long description, as for example in the last box, the box is going to be bigger and bigger.
The problem is if fix max-height for the container that's will not work, same thing for the things inside because it makes all responsive rules and media query not working after.
the only solution that I've found is cutting text inside <p> with
.descr_p{
max-height: 90px;
text-overflow: ellipsis;
/* white-space: nowrap; */
overflow: hidden;
}
but if uncomment white space: nowrap a mess like this happens:
so the questions are 2 :)
which one is the best way to fix maximum dimension and keep the whole thing responsive.
how can I make otherwise "whitespace: nowrap" working;
apologize if I've asked silly things but I'm very newbie in CSS styling.
You need to apply max-width property in descr_p according to what you want. max-height would not work.
.descr_p{
max-width: 105px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
Also , you can use flexbox to design your layout. You would not need to worry about size of text then.
Your structure is wrong. If you reduce width of the screen to below 1180px. There is not space to Address and mobile number.
you can use 'Media Object' and simplify your structure. Media Object
And for height issue you can use below jquery:
jQuery(function($) {
var tallest = 0;
$('.profile_view .col-sm-12').each(function() {
var height = $(this).height();
if (height > tallest) {
tallest = height;
}
});
$('.profile_view .col-sm-12').height(tallest);
});
Related
This is how It must looks like:
here is the image , circle is a place where phtoto must be uploaded
<div class="container ">
<div class="row mx-auto">
<div class="col ">
<span class="border border-success rounded-circle">
<button class="btnUpload">
<i class="fa fa-upload"></i> Upload
</button>
</span>
</div>
</div>
</div>
First of all: use "className" instead of "class" when working with react. To your problem: span is an inline element and doesn't have border. Turn it into a block element by setting display to block or use div element instead. Then center button vertically and horizontally inside of it, for example with flexbox:
<div
className="border border-success rounded-circle"
style={{ width: 100, height: 100, margin: 50 }}
>
<div className="h-100 d-flex justify-content-center align-items-center">
<button className="btnUpload">
<i class="fa fa-upload"></i> Upload
</button>
</div>
</div>
https://codesandbox.io/s/white-http-wsy881
So I have this card with a div inside it. And the idea is that I want to show a icon to the left and then a text to the right of the icon indicating a username can be up to 32 characters long.
<div>
<h5 class="d-inline"><i class="icofont icofont-social-snapchat"></i></h5>
<p class="d-inline">rwmGhw9El8cBMeyvzQ18fmZP2EbLaQhY</p>
</div>
The issue is that when I start shrinking the page, the text gets places under the icon and it starts going outside of the card.
I'm actually not sure to why this happens or what the best way to fix this is.
How do I properly deal with something like this? Would adding ellipsis be a good idea?
Here is the markup for the card
<div class="col-xl-4 px-2">
<div class="card card-with-border mt-5 ">
<div class="card-body mb-0">
#foreach (var item in user.Tags)
{
<span class="badge badge-primary mt-3 ml-0">#item</span>
}
</div>
<div class="card-body socialprofile filter-cards-view pt-2">
<div class="media">
<div class="avatar ratio"><img class="b-r-8 height-50 mr-3 img-80" src=#user.Image alt="#"></div>
<div class="media-body">
<h6 class="font-danger f-w-600">Hello, World!</h6>
<div>
<h5 class="d-inline"><i class="icofont icofont-social-snapchat"></i></h5>
<p class="d-inline">rwmGhw9El8cBMeyvzQ18fmZP2EbLaQhY</p>
</div>
<span class="card-text"><h5><i class="icofont icofont-social-instagram"></i></h5><p></p></span>
<p class="card-text mt-2">Testing the text lets see what it looks like.</p>
</div>
</div>
<div class="social-btngroup d-flex">
<button class="btn btn-primary w-100">Like</button>
</div>
<div class="likes-profile text-center">
<h5> <span> <i class="fa fa-heart font-danger"></i> 884</span></h5>
</div>
</div>
</div>
</div>
Your element need to be in display: block or display: inline-block.
/* Limit size of media-body */
.media-body {
max-width: calc(100% - 2rem);
}
.ellipsis {
display: block !important;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
<div>
<h5 class="d-inline"><i class="icofont icofont-social-snapchat"></i></h5>
<!-- Add the class ellipsis where you want -->
<p class="d-inline ellipsis">rwmGhw9El8cBMeyvzQ18fmZP2EbLaQhY</p>
</div>
I have a link button that I need to place to the right of a div. Adding float-left on the div and float-right on the link button does not do it. What am I doing wrong?
https://jsfiddle.net/3v2s4c50/
<div class="container">
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">Today and Tomorrow</div>
<div class="card-body">
<div class="float-left">Someone somewhere is waiting for you.</div>
<a role="button" href="google.com" class="float-right btn btn-primary"> Login</a>
</div>
</div>
</div>
<div class="col">
2 of 2
</div>
</div>
</div>
remove floats and add:
.card-body{
display: flex;
justify-content: space-between;
align-items: center;
}
<div class="card-body d-flex">
<div class="flex-fill">Someone somewhere is waiting for you</div>
<a role="button" href="google.com" class="flex-fill btn btn-primary"> Login</a>
</div>
Well, it is doing it. But the portion of the screen that is showing the results is not wide enough to show both the div with the text and the button in the same row.. then it breaks down.
If you change the text to something smaller, like 'Someone is waiting' you can see the button floating right :)
You can also set a fixed width for your text div (currently it is expanding based on the content).
<div class="card-body">
<div class="float-left" style="width: 50%;">Someone somewhere is waiting for you</div>
<a role="button" href="google.com" class="float-right btn btn-primary"> Login</a>
</div>
You can add your link to a div with any class. Then add style "text-align: right;" into your div like this:
.my-link {
text-align: right;
}
.
<div class="my-link">
<a role="button" href="google.com" class="float-right btn btn-primary"> Login</a>
</div>
.
I hope this will be useful.
I have used the following style inside the element of my html to get rid of the extra white space on the right side of the screen:
<style>
html,body{
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
overflow-x: hidden;
}
</style>
And it worked perfectly fine. However, it sets the visibility of some of the content on of the pages to be "hidden" and I have tried using the !important attribute to overwrite but no matter what I do, they remain invisible.
<div class="col-lg-3 col-md-6 wow fadeInUp" data-wow-delay="0.2s">
<div class="box">
<div class="icon"><a href=""><i>
<img class="featurette-image img-fluid mx-auto" data-src="holder.js/500x500/auto" src="/img/yusufImg/slope%20design.png" alt="Generic placeholder image">
</i></a></div>
<h4 class="title">Slope Design</h4>
<a id="slopeButton" class="btn btn-lg btn-outline-success" style="font-weight: 900;color: white;">Read More</a>
</div>
</div>
<div style=" visibility:visible !important;" class="col-lg-3 col-md-6 wow fadeInUp" data-wow-delay="0.2s">
<div class="box">
<div class="icon"><a href=""><i>
<img class="featurette-image img-fluid mx-auto" data-src="holder.js/500x500/auto" src="/img/yusufImg/taş%20duvar.png" alt="Generic placeholder image">
</i></a></div>
<h4 class="title">Tas Duvar</h4>
<a id="tasduvarButton" class="btn btn-lg btn-outline-
success" style="font-weight: 900;color: white;">Read More</a>
</div>
Ones with the inline style for visibility have the same exact attributes and classes as the ones that don't. However, they are always rendered to be invisible when I load the page.
How can I fix this?
How would I go about centering this button besides the image?
top:50% won't work as the parent does not have a fixed size
<div class="row">
<div class="col-xs-12 col-sm-2">
<p style="padding:20px;"></p>
<img src="img/logo.png" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-2">
<div class="btn-group btn-block" role="group">
<a type="button" class="btn btn-block btn-warning" style="top:50%;">Sign in
</a>
</div>
</div>
</div>
Here is a fiddle example:
https://jsfiddle.net/DTcHh/#&togetherjs=d6NLIis7u4
I used display: table, display: table-cell and vertical-align: middle tricks, among others, on this one:
https://jsfiddle.net/qh7nrcyh/1/
Please check if it works on you.
The best way to vertically center something with css is using line-height. But this only works if you have a fixed height and a single line of text.