I want to display cards in the same height even when the content(pattern-name) differs.I'm getting the content from DB.
Here is my html code
<div class="wrapper" *ngFor="let row of Pattern,I">
<div class="profile-card">
<div class="profile-card__unit-description">
<fa-icon
size="3x"
[icon]="faBrain"
class="icon"></fa-icon>
</div>
<div class="profile-card__unit-name">{{row.Pattern_Name}}</div> //This pattern name I'm getting it from DB.
<a class="fancy-button bg-gradient1" *ngIf="arr[row.Pattern_Id] == 1" onclick="return false">
<span (click)="onselect(row)">
<i size="2x" class="fa fa-ticket" ></i>Start
</span>
</a>
</div>
</div>
Here is my CSS for wrapper and profile-card
.wrapper {
display: inline-block;
margin: 0 50px;
padding-top: 100px;
padding-bottom: 80px;
}
.wrapper:focus {
outline: 0;
}
.profile-card {
background: white;
width: 300px;
display: inline-block;
margin: auto;
border-radius: 19px;
position: relative;
text-align: center;
box-shadow: -1px 15px 30px -12px black;
height:inherit;
}
.profile-card__unit-name {
font-size: 22px;
color: black;
margin-bottom: 10px;
margin-top:0px;
margin-left:10px;
margin-right:15px;
height:inherit;
}
.profile-card__unit-description {
padding: 20px;
color:#F9C118;
}
Please help me in doing that. Thanks in advance
as of now I did not get the reply from you that you want these 2 items side by side or up and down, so just seeing your code, I am assuming that you need it side by side.
so in your case just use display: flex; and flex-child will take the same height which will be side by side, to make last-child anchor below use flex-wrap: wrap and it will go down as first 2 items will take 50% width each.
I have given both div's background color just for demo purpose so that you can see these are taking equal height.
.wrapper {
display: inline-block;
margin: 0 50px;
padding-top: 100px;
padding-bottom: 80px;
}
* {
box-sizing: border-box;
}
.wrapper:focus {
outline: 0;
}
.profile-card {
background: white;
width: 300px;
display: inline-block;
margin: auto;
border-radius: 19px;
position: relative;
text-align: center;
box-shadow: -1px 15px 30px -12px black;
height:inherit;
display:flex;
flex-wrap: wrap;
}
.profile-card__unit-name {
font-size: 22px;
width: 50%;
color: black;
margin-top:0px;
padding-top: 20px;
background: green;
}
.profile-card__unit-description {
padding: 20px;
width: 50%;
color:#F9C118;
background: red;
}
.fancy-button {
width: 100%;
display: block;
}
<div class="wrapper" *ngFor="let row of Pattern,I">
<div class="profile-card">
<div class="profile-card__unit-description">
<p>dummy data for demo onlydummy data for demo onlydummy data for demo onlydummy data for demo onlydummy</p>
<fa-icon
size="3x"
[icon]="faBrain"
class="icon"></fa-icon>
</div>
<div class="profile-card__unit-name">row Pattern_Name</div>
<a class="fancy-button bg-gradient1">
<span (click)="onselect(row)">
<i size="2x" class="fa fa-ticket" ></i>Start
</span>
</a>
</div>
</div>
if need something else, feel free to share
Related
I have a very simple html web page on which I display two buttons whose contents are pictures of text. The buttons have a white background and gold outline. However, they now have a black bar that protrudes from the right side of each button.
The only way I have found to be able to move them is running
<button class="button button2" style="vertical-align:middle"><a href=""><img class="chatbutton" src="img/chatbutton.png" />
where the vertical-align attribute changed if the bar is on the bottom right corner of the button or in the middle of it.
My code is:
.button {
border-radius: 12px;
background: white;
border: 4px solid #FFD500;
text-align: center;
padding: 20px;
margin: auto;
overflow: hidden;
}
.button:hover {
background: #FFD500;
outline: medium none;
}
.button1 {
width: 150px;
height: 75px;
}
.outer {
display: table;
position: absolute;
height: 100%;
width: 100%;
}
.middle {
display: table-cell;
vertical-align: middle;
}
.main {
background-color: white;
background: white;
width: 95%;
margin: 0 auto;
text-align: center;
margin-top: 20px;
padding-top: 40px;
padding-bottom: 20px;
border: 2px solid #494A4A;
border-radius: 25px;
margin-left: auto;
margin-right: auto;
}
#media screen and (min-width: 480px){
.main {
background-color: white;
width: 50%;
margin: 0 auto;
text-align: center;
margin-top: 20px;
padding-top: 40px;
padding-bottom: 20px;
border: 2px solid #494A4A;
border-radius: 25px;
margin-left: auto;
margin-right: auto;
}
}
<body style="background-color:#494A4A">
<div class="outer">
<div class="middle">
<div class="main">
<button class="button button1" ><a href=""><img
class="filebutton" src="" /></button>
</div>
</div>
</div>
</body>
img { border-radius: 60px; box-shadow: 1px 1px 1px rgba(0,0,0,0.5); width: 284px; height: 108px; object-fit: none; object-position: 50% 20%; } // object position can be adjusted to fit your liking
<body>
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRsuLEXVtGfxNCEOgIKdeIT4ki9LK3JwiGAs0YtuAXJHay8WZhw">
</body>
I would actually make the image a button itself, rather then using a button tag. But you can also use the button tag and style it.
I want show a html div wich contains a state-descritpiton with a circle (green or red). This circle shows the state of the enigne in the right corner of the description.
My problem is the following. If the windows size has changed (smaler), the description and the "state-circle" overlap each other.
How can i prevent this?
Do you know how the css-code should be?
structure is mainly this:
.statusdiv{
height: 40px;
}
.statusbeschreibung{
position: absolute;
margin-left: 40%;
}
.statuskreis {
position: absolute;
width: 25px;
height: 25px;
top: 13px;
/*left: 190px;*/
margin-left: 60%;
border: 1px solid black;
text-align: center;
border-radius: 12.5px;
}
.status-on{
background-color: green;
}
.status-off{
background-color: red;
}
<div class="list-block">
<ul>
<li>
<div class="statusdiv">
<p class="statusbeschreibung">Motorstatus</p>
<div name="motorstatus" id="motorstatus" class="item-link statuskreis status-off"></div>
</div>
</li>
</div>
This was based on your original screenshot images of your code: basically you should use display:inline-block instead of position:absolute to prevent your bullet from overlapping your text, and then use a margin-left on the bullet so that it always has enough space between it and the text.
.list-block ul {
padding: 0;
margin: 0;
}
.list-block li {
list-style: none;
}
.statusdiv {
white-space: nowrap;
}
.statusbeschreibung {
margin-left: 40%;
display: inline-block;
vertical-align: middle;
}
.statuskreis {
width: 25px;
height: 25px;
margin-left: 10px;
border: 1px solid black;
text-align: center;
border-radius: 12.5px;
display: inline-block;
vertical-align: middle;
}
.status-on {
background-color: green;
}
.status-off {
background-color: red;
}
<div class="list-block">
<ul>
<li>
<div class="statusdiv">
<p class="statusbeschreibung">Motorstatus</p>
<div name="motorstatus" id="motorstatus" class="item-link statuskreis status-off"></div>
</div>
</li>
<li>
<div class="statusdiv">
<p class="statusbeschreibung">Motorstatus</p>
<div name="motorstatus" id="motorstatus" class="item-link statuskreis status-on"></div>
</div>
</li>
</ul>
</div>
If I'm understanding it correctly, you style the circle with the class "motortatus".
Try to set the width and height in percentages, not in pixels. This should resize the status circle and prevent it from overlapping with the description, except the font of the description doensn't resize at all and fills up the whole div.
I love inline lists for this sort of thing, but you can also do columns in your preferred css framework of choice.
I've styled it so each of the two list items is 50% of the width of the ul container, but you can tweak those as you see fit.
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.statusdiv {
list-style: none;
float: left;
margin: 0;
padding: 1em;
width: 100%;
color: #2d2d2d;
}
.statusdiv li {
width: 50%;
float: left;
padding: 0 1em;
}
.statusdiv li:first-child {
text-align: right;
height: 35px;
line-height: 35px;
}
.statusdiv li:last-child {
text-align: left;
}
.circle {
content: "";
background-color: aqua;
width: 35px;
height: 35px;
display: inline-block;
-webkit-border-radius: 100%;
-moz-border-radius: 100%;
border-radius: 100%;
}
<!-- EDIT THIS SNIPPET -->
<ul class="statusdiv">
<li>
Status thing:
</li>
<li><span class="circle"></span></li>
</ul>
Sometimes when I come back to html I forget the simple things...
I want to be able to get the spans inside the div to center. IDK if I have it structured right, feel free to suggest anything
https://jsfiddle.net/yxg1zsac/
.define_link {
background: rgba(0,0,0,.3);
border-radius: 10px;
padding: 5px;
width: 200px;
margin: 5px auto;
font-size: 20px;
display: inline-block;
font-weight: bold;
text-align: center;
}
.pagination {
width:100%;
margin:auto
}
<div class="pagination">
<span class="define_link">previous</span>
<span class="current">Page 2 of 88.</span>
<span class="define_link">next</span>
</div>
Try this:
https://jsfiddle.net/tobyl/yxg1zsac/1/
Critical CSS:
.pagination {
text-align: center;
}
i think you want to this check it
https://jsfiddle.net/bhavhirani/gnrqxxka/1/
.define_link {
background: rgba(0,0,0,.3);
border-radius: 10px;
padding: 5px;
width: 200px;
margin: 5px auto;
font-size: 20px;
display: inline-block;
font-weight: bold;
text-align: center;
}
.define_link.prev{
float:left;
}
.current {
display: block; float: left; width: 30%; margin: 10px auto; text-align: center;
}
.define_link.next{
float:right;
}
.pagination {
width:100%;
margin:auto;
}
<div class="pagination">
<span class="define_link prev">previous</span>
<span class="current">Page 2 of 88.</span>
<span class="define_link next">next</span>
</div>
I know there were many similar questions, but I couldn't figure it out.
I have the following div:
#inputHeader {
width: 100%;
background: #30273a;
border-radius: 10px 10px 0px 0px;
}
#inputHeaderTitle {
color: white;
margin-left: 10px;
display: inline-block;
}
#inputHeaderEdit {
color: white;
display: inline-block;
}
<div id="inputHeader">
<p id="inputHeaderTitle">Header</p>
<span id="inputHeaderEdit" class="glyphicon glyphicon-pencil"></span>
</div>
I want the "inputHeaderTitle" on the left side of the div, and the "inputHeaderEdit"-span on the right side. How can I do this?
Edit:
Here is a jsfiddle: https://jsfiddle.net/9nuhay76/1 where I did float:left/right. But if I do so, the outer DIV gets a height of 0px. Why?
#inputHeader {
width: 100%;
background: #30273a;
border-radius: 10px 10px 0px 0px;
display: flex;
align-items: center;
padding: 0 10px;
box-sizing: border-box;
}
#inputHeaderTitle {
color: white;
display: inline-block;
flex: 1;
}
#inputHeaderEdit {
color: white;
display: inline-block;
}
<div id="inputHeader">
<p id="inputHeaderTitle">Header</p>
<span id="inputHeaderEdit" class="glyphicon glyphicon-pencil">Edit</span>
</div>
<div id="inputHeader">
<p id="inputHeaderTitle" style="float:left">Header</p>
<span id="inputHeaderEdit" style="float:right" class="glyphicon glyphicon- pencil"></span>
</div>
Do you mean like this?
You can add float: right
Like this:
jsbin
Firstly you should not use float for positioning. You are in the right place with display inline-block.
try using display table instead though and then text alignment to position them left or right as bellow.
#inputHeader {
width: 100%;
background: #30273a;
border-radius: 10px 10px 0px 0px;
}
#inputHeaderTitle {
color: white;
margin-left: 10px;
display: inline-block;
}
#inputHeaderEdit {
color: white;
display: inline-block;
}
/* NEW */
.align-table {
display: table;
width: 100%;
table-layout: fixed;
}
.t-align {
display: table-cell;
vertical-align: top;
width: 100%;
}
.align-center {
text-align: center;
}
.align-left {
text-align: left;
}
.align-right {
text-align: right;
}
<div id="inputHeader" class="align-table">
<div class="t-align">
<p id="inputHeaderTitle">Header</p>
</div>
<div class="t-align align-right">
<span id="inputHeaderEdit" class="glyphicon glyphicon-pencil"></span>
</div>
</div>
How do I make two (or more) floating divs appear like "big buttons" and let them float and be leveled? My problem is that the boxes are "partially leveled"... with one slightly lower than the other. I have tried to use float: left on the adminBox, but then they grow outside the container. Can anyone help me?
I have used this HTML code:
(http://jsfiddle.net/jf936/13/)
<div class="container">
<div class="adminBox">
<h2>Manage users</h2>
<div class="adminBoxLargeContent" data-bind="text: usersCount"></div>
<div class="adminBoxSmallContent">Registered users</div>
</div>
<div class="adminBox">
<h2>Manage templates</h2>
<div class="adminBoxLargeContent" data-bind="text: templateCount"></div>
</div>
and this style:
.container{
background-color: light-blue;
}
.adminBox{
height: 200px;
width: 200px;
background-color: green;
color: white;
border-radius: 7px;
padding: 7px;
display: inline-block;
margin: 5px;
}
.adminBox h2{
color:white;
font-size:20px;
text-align:center;
}
.adminBoxLargeContent{
font-size: 70px;
text-align:center;
padding: 0;
margin: 0;
line-height: 1;
}
.adminBox .adminBoxSmallContent{
float: none;
text-align:center;
}
This has nothing to do with float, the issue is that you are using display: inline-block; and hence the element are aligned to the baseline, inorder to fix this, you need to use vertical-align: top;
Demo
.adminBox{
height: 200px;
width: 200px;
background-color: green;
color: white;
border-radius: 7px;
padding: 7px;
display: inline-block;
margin: 5px;
vertical-align: top; /* Add this here */
}
Note: You don't have to use float: none; as nothing is floated here, so you can get rid of those unused properties.
Here you go.
WORKING DEMO
The CSS Code Change:
.adminBox{
height: 200px;
width: 200px;
background-color: green;
color: white;
border-radius: 7px;
padding: 7px;
display: inline-block;
margin: 5px;
float:left;
}
Hope this helps.
Maybe this code will be helpful for you:
jsfiddle
.container{
background-color: light-blue;
overflow:hidden;
}
.adminBox{
height: 200px;
width: 200px;
background-color: green;
color: white;
border-radius: 7px;
padding: 7px;
display: block;
margin: 5px;
float:left;
}
.adminBox h2{
color:white;
font-size:20px;
text-align:center;
}
.adminBoxLargeContent{
font-size: 70px;
text-align:center;
padding: 0;
margin: 0;
line-height: 1;
}
.adminBox .adminBoxSmallContent{
text-align:center;
}
<div class="container">
<div class="adminBox">
<h2>Manage users</h2>
<div class="adminBoxLargeContent" data-bind="text: usersCount"></div>
<div class="adminBoxSmallContent">Registered users</div>
</div>
<div class="adminBox">
<h2>Manage templates</h2>
<div class="adminBoxLargeContent" data-bind="text: templateCount"></div>
</div>
</div>