I have a treetable which columns have an icon and text like this (this is fine)*:
However, when I reduce the width of the screen, this happens:
And I would like to have something like this:
My html is like this:
<tr data-tt-id="2" data-tt-parent-id="1">
<td>
<i class="fa fa-lg fa-file-text-o"></i>
Title
</td>
</tr>
And my js is:
$("#requestForQuotationTable").treetable({
expandable: true,
indent: 15
});
And the code generated by treetable is this:
<tr data-tt-id="2" data-tt-parent-id="1">
<td>
<span class="indenter" style="padding-left: 15px;"></span>
<i class="fa fa-lg fa-file-text-o"></i>
Title
</td>
</tr>
I have tried setting pull-left in the icon as suggested in here, but then it ignores the span.indenter element, getting the icon to the left.
I have also tried this, with no good results either because of the span.indenter.
All what I have tried leads me to think that my problem is with the span.indenter, but I can't figure out a way to solve this.
Edit after Jayababu's response:
<td>
<span class="indenter" style="padding-left: 30px;float: left;"></span>
<span style="float:left">
<i class="fa fa-lg fa-file-text-o" style="vertical-align: middle;"></i>
</span>
<span style="float:left"><a href="javascript:void(0)" style="cursor: pointer;">
hgjkghjk ghjk ghjk ghjk hgjk hgjkghjk</a>
</span>
</td>
looks like this (it's still ignoring the indenter and the text is not looking good =():
*I have created these images from the example in http://ludo.cubicphuse.nl/jquery-treetable/#usage
In the page you have mentioned,the folder image is loading as a background image
for the span.
If you need a design like you have shown in the third screen shot.
Restructuring is the only one solution in your case.
Ideally you need to create 2 elements let it be 2 spans one to hold the image,another to hold the text.Align both the spans with float:left.
Please find the below code snipped,working fine as you need
As we cant display images in the code snippet,i have just colored the indenter and folder icon with red and green.
.folder{
float: left;
background: green;
width: 20px;
height: 20px;
display: inline;
}
.indenter> a{
background: red;
width: 19px;
}
.indenter{
padding-left: 30px;
float: left;
display: inline;
}
.content{
display: inline;
height: auto;
}
<table>
<tbody><tr class="branch ui-droppable expanded selected" data-tt-id="3-1" data-tt-parent-id="3" style="display: table-row;">
<td>
<span class="indenter" > </span>
<span class="folder" >
<i class="fa fa-lg fa-file-text-o" style="vertical-align: middle;"></i>
</span>
<span class="content" ><a href="javascript:void(0)" style="cursor: pointer;">
hgjkghjk ghjk ghjk ghjk hgjk hgjkghjkhgjkghjk ghjk ghjk ghjk hgjk hgjkghjk</a>
</span>
</td>
</tr>
</tbody></table>
Related
I have a table and in one of the columns exists two icons.
here is the pic
this is the code:
<td>
<i class="zmdi zmdi-plus-circle-o text-success"></i>
<i class="zmdi zmdi-help zmdi-hc-fw" data-toggle="tooltip" data-placement="top" data-container="body" data-html="true" title="" data-original-title="ADD"></i>
</td>
I need the icons to be in the same line and the same height as the other icons.
So I added display: flex.
And get this result:
And since I need the icons to be in the same line as the other I used:
padding-top: 23px and get this results
The problem is when I hover with the mouse on the line, in this place exists the white or blank space.
The white space starts exactly after I used display flex, and reduces a little after I used padding top.
I do not want this white blank, so when I hover all the line will be blue as before (first pic).
can someone assist
this is my new code:
<td style="display: flex;padding-top: 23px;">
<i class="zmdi zmdi-plus-circle-o text-success"></i>
<i class="zmdi zmdi-help zmdi-hc-fw" data-toggle="tooltip" data-placement="top" data-container="body" data-html="true" title="" data-original-title="ADD"></i>
</td>
this is the computed tab
If I do this in the developer tools it solved, how to do it via code?
Take a look, I have created an example and it works, so you should check CSS code.
If you cannot provide CSS code how can I help?
table {
border: 1px solid red;
width: 50%;
}
<table>
<tr>
<td style="display: flex;">
<i style="width: 25px;height: 25px;border: 1px solid blue;display: unset;"
class="zmdi zmdi-plus-circle-o text-success"></i>
<i style="width: 25px;height: 25px;border: 1px solid blue;display: unset;"
class="zmdi zmdi-help zmdi-hc-fw"
data-toggle="tooltip"
data-placement="top"
data-container="body"
data-html="true" title=""
data-original-title="ADD">
</i>
</td>
</tr>
</table>
I am building a website that has the usual social media links in a footer on my page:
They are hosted in an HTML element coded as:
<div class="social">
<table>
<tr>
<td>Tweet </td>
<td>
<div
class="fb-like"
data-href="#Context.Request.Scheme://#Context.Request.Host.ToString()#Context.Request.PathBase#Context.Request.Path"
data-layout="button"
data-action="like"
data-show-faces="true">
</div>
</td>
<td>
<script type="IN/Share" data-counter="right">
</script>
</td>
<td><a href="//www.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark"><img alt="Pin it" src="//assets.pinterest.com/images/pidgets/pin_it_button.png" border="0" /></td>
</tr>
</table>
</div>
How can I force the alignment or padding of the buttons to be consistent?
Alternatively, if I want to use my own icons and hide these is there a standard approach to doing that?
Thanks
Mark
The way this is constructed is wrong! Please use table for data and not for styling. Change it to a div and you'll find that making it mobile responsive is easy.
Try to nest the divs so you can just move your main div and all the sub-divs within it moves along.
Try something like this:
.social { display: inline-block; }
<div id="social-icons">
<div class="social"><img src="http://lorempixel.com/50/25/"></div>
<div class="social"><img src="http://lorempixel.com/50/25/"></div>
<div class="social"><img src="http://lorempixel.com/50/25/"></div>
<div class="social"><img src="http://lorempixel.com/50/25/"></div>
</div>
And to make changes when viewing from a smaller screen - eg; mobile, then use media queries to align the content when a certain device size is reached.
Media Query CSS:
#media screen and (max-width: 480px) {
.social {
display: block;
width: 100%;
}
}
Of course, change the css styling to whichever you prefer.
I would use flex instead of a table layout. Set the parent element to display: flex; and align-items: top;. That forces the direct children of .social to align at the top.
.social {
display: flex;
align-items: top;
}
.social a {
padding: 5px 10px;
margin: 5px;
background-color: yellow;
}
<div class="social">
Facebook
Instagram
Pinterest
Twitter
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="social">
<table>
<tr>
<td>
<button type="button" class="btn btn-info">
<i class="fa fa-twitter" aria-hidden="true"></i>
Tweet </button>
</td>
<td>
<button type="button" class="btn btn-success">
<i class="fa fa-thumbs-up" aria-hidden="true"></i>
Like </button>
</td>
<td>
<button type="button" class="btn btn-success">
<i class="fa fa-thumbs-up" aria-hidden="true"></i>
Share </button>
</td>
<td>
<button type="button" class="btn btn-danger">
<i class="fa fa-thumbs-up" aria-hidden="true"></i>
Save </button>
</td>
</tr>
</table>
</div>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
So I have a few <td> elements within a <table> where I want all elements on the same line with no wrapping. I am using css white-space: nowrap; By default, all elements are horizontally aligned to the left and so I also use some float:right; to space some elements.
This works great in Chrome, but in Firefox it seems to add another line and its a weird bug. How can I keep everything on the same line in FIREFOX?
scenario 1
<td style="white-space: nowrap;">
<a data-id="10796" data-pr="MOV1">AGG55TTYY</a>
<span style="font-size:13px; color:#0fb124; font-weight:bold; float:right; vertical-align:middle;">
<i class="fa fa-arrow-circle-up" aria-hidden="true"></i> <span style="color:#eeeeee;"><i class="fa fa-file-text-o" aria-hidden="true"></i></span>
<span style="font-size:11px; color:#cc0000;">2</span>
</span>
</td>
scenario 2 and 3
<td style="white-space: nowrap;">
MOV3<span style="font-size:11px; color:#AAAAFF; font-weight:bold; float:right; vertical-align:middle;">#JJ655</span>
</td>
You can fix your issue by either adding float left to the anchor:
<table style="width:100%;">
<td style="white-space: nowrap;">
<a data-id="10796" data-pr="MOV1" style="float:left">AGG55TTYY</a>
<span style="font-size:13px; color:#0fb124; font-weight:bold; float:right; vertical-align:middle;">
<i class="fa fa-arrow-circle-up" aria-hidden="true"></i> <span style="color:#eeeeee;"><i class="fa fa-file-text-o" aria-hidden="true"></i></span>
<span style="font-size:11px; color:#cc0000;">2</span>
</span>
</td>
</table>
Or putting your anchor after your span
<table style="width:100%;">
<td style="white-space: nowrap;">
<span style="font-size:13px; color:#0fb124; font-weight:bold; float:right; vertical-align:middle;">
<i class="fa fa-arrow-circle-up" aria-hidden="true"></i> <span style="color:#eeeeee;"><i class="fa fa-file-text-o" aria-hidden="true"></i></span>
<span style="font-size:11px; color:#cc0000;">2</span>
</span>
<a data-id="10796" data-pr="MOV1">AGG55TTYY</a>
</td>
</table>
I am making use of the following css to toggle a chervon, but the problem is at start-up the wrong chevron is display. As soon as you start the toggle, it works. Not sure what I'm doing wrong?
CSS:
.arrow-toggle .fa-chevron-down,
.arrow-toggle.collapsed .fa-chevron-right {
display: inline-block;
}
.arrow-toggle.collapsed .fa-chevron-down,
.arrow-toggle .fa-chevron-right {
display: none;
}
HTML:
<tr ng-repeat-start="foo in vm.bar track by $index"
data-toggle="collapse" data-target="#task{{$index}}"
class="arrow-toggle">
<td>
<i class="fa fa-chevron-right" aria-hidden="true"></i>
<i class="fa fa-chevron-down" aria-hidden="true"></i>
</td>
</tr>
See the Pen Chevron Toggle Issue by Richard (#Programm3r) on CodePen.
Thanks in advance!
add class collapsed to the tr initially
<tr ng-repeat-start="foo in vm.bar track by $index"
data-toggle="collapse" data-target="#task{{$index}}"
class="arrow-toggle collapsed">
<td>
<i class="fa fa-chevron-right" aria-hidden="true"></i>
<i class="fa fa-chevron-down" aria-hidden="true"></i>
</td>
</tr>
The .fa-chevron-down is hidden if the tr has the class .collapsed
.arrow-toggle.collapsed .fa-chevron-down,
.arrow-toggle .fa-chevron-right {
display: none;
}
http://codepen.io/anon/pen/LbWwdN
I am trying to get a make a div which contains a set of tools responsive.I have a side menu below this which I have made responsive. Could someone let me know where would this be wrong.
#tools {
width: 160px;
position: fixed;
display: inline-block;
margin: 0 auto;
line-height: 1.4em;
}
#media only screen and (max-width: 600px) {
#tools {
width: 70%;
}
}
<div id="tools" style="width: 100%">
<table>
<tr>
<td>
<input type="text" id="searchInput" placeholder="Type To Filter" ng-model="search" class="searchMenu">
</td>
<td id=uploadedit>
<button id="upload" onclick="insertIntoDatabase()" class="pinColor"><i class="fa fa-upload fa-2"></i>
</button>
</td>
<td id=impledit>
<button id="implview" onclick="openImplView()" class="pinColor"><i class="fa fa-pencil fa-2"></i>
</button>
</td>
<td>
<button id="home" class="homeButton"><i class="fa fa-home fa-2"></i>
</button>
</td>
<td>
<button id="keep-menu-open" class="pinColor" ng-click="openAndFixMenu"><i class="pinColor"></i>
</button>
</td>
<td>
<button id="open-left" class="toggleButton" ng-click="toggleMenu()"> <i class="fa fa-bars fa-2"></i>
</button>
</td>
</tr>
</table>
</div>
You have a typo in your media query: it should be # instead of ##. Aside from that, you're declaring width: 100% inline which overwrites whatever you've written in a stylesheet, which is why you don't see the result of the query.
Probably best to take the style="100%" from the div, any inline style like this will over-ride whatever is in the stylesheet.
Also in the media query you have
##tools { width: 70%; }
change to
#tools { width: 70%; }