How do I get the row details of the datagrid component to take up the full width of the available space in the grid?
I've tried modifying flex and width properties of different css classes, but nothing I've tried seems to be working.
https://plnkr.co/edit/Y7L3eGpYbzvd31HK0v2F?p=preview
<clr-datagrid>
<clr-dg-column clrDgField="firstname">First name</clr-dg-column>
<clr-dg-column clrDgField="lastname">Last name</clr-dg-column>
<clr-dg-row *clrDgItems="let user of users">
<clr-dg-cell>{{user.firstname}}</clr-dg-cell>
<clr-dg-cell>{{user.lastname}}</clr-dg-cell>
<my-detail *clrIfExpanded ngProjectAs="clr-dg-row-detail"></my-detail>
</clr-dg-row>
<clr-dg-footer>{{users.length}} items</clr-dg-footer>
</clr-datagrid>
#Component({
selector: "my-detail",
template: `
<clr-dg-row-detail [clrDgReplace]="true">
<div class="row">
<div class="col-xs-2">Lorem Ipsum:</div>
<div class="col-xs-4">...</div>
<div class="col-xs-2">Lorem Ipsum:</div>
<div class="col-xs-4">...</div>
</div>
</clr-dg-row-detail>
})
Its hard to say if this is the answer to your question. You shouldn't need to change the datagrid css to get content to take up a full row. Expandable rows can be used with content that takes up the whole row or with content that takes up space on a per column basis.
Here is a plunk with expandable rows implemented so you can swap full row content with per column content.
https://plnkr.co/edit/9cj1lE5B4dwpRSRcKXXX?p=preview
The relevant html looks like this:
<clr-datagrid>
<clr-dg-column>User ID</clr-dg-column>
<clr-dg-column>Name</clr-dg-column>
<clr-dg-column>Creation date</clr-dg-column>
<clr-dg-row *clrDgItems="let user of users" [clrDgItem]="user">
<clr-dg-cell>{{user.id}}</clr-dg-cell>
<clr-dg-cell>{{user.name}}</clr-dg-cell>
<clr-dg-cell>{{user.creation | date}}</clr-dg-cell>
<!-- Example using a wrapper component -->
<clr-dg-row-detail *clrIfExpanded>
<ng-template [ngIf]="detail === 'default'">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin in neque in ante placerat mattis id sed
quam. Proin rhoncus lacus et tempor dignissim. Vivamus sem quam, pellentesque aliquet suscipit eget,
pellentesque sed arcu. Vivamus in dui lectus. Suspendisse cursus est ac nisl imperdiet viverra. Aenean
sagittis nibh lacus, in eleifend urna ultrices et. Mauris porttitor nisi nec velit pharetra porttitor.
Vestibulum vulputate sollicitudin dolor ut tincidunt. Phasellus vitae blandit felis. Nullam posuere
ipsum tincidunt velit pellentesque rhoncus. Morbi faucibus ut ipsum at malesuada. Nam vestibulum felis
sit amet metus finibus hendrerit. Fusce faucibus odio eget ex vulputate rhoncus. Fusce nec aliquam leo,
at suscipit diam.
</ng-template>
<ng-template [ngIf]="detail === 'cols'">
<clr-dg-cell>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</clr-dg-cell>
<clr-dg-cell>Proin in neque in ante placerat mattis id sed quam.</clr-dg-cell>
<clr-dg-cell>Proin rhoncus lacus et tempor dignissim.</clr-dg-cell>
<clr-dg-cell>Vivamus sem quam, pellentesque aliquet suscipit eget, pellentesque sed arcu.</clr-dg-cell>
<clr-dg-cell>Vivamus in dui lectus. Suspendisse cursus est ac nisl imperdiet viverra.</clr-dg-cell>
</ng-template>
</clr-dg-row-detail>
</clr-dg-row>
<clr-dg-footer>{{users.length}} users</clr-dg-footer>
</clr-datagrid>
Related
When I'm looking at a text file on GitHub.com, how can I make it wrap the lines instead of having horizontal scroll?
In the GitHub website editor, I can choose the option "Soft Wrap" from a top-right drop down, but there is no such drop down, nor any option anywhere on the page that I can find, to also wrap lines when just viewing code.
I've tried to write user stylesheets to customise the appearance, but manually setting the width of the <td> that the line of code is in or the <table> that the code and line numbers are in doesn't actually change the width of that element, and setting different overflow values here doesn't change the behaviour either.
This is because the td.blob-code table cells containing code lines in GitHub viewer have the CSS rule white-space: pre, which forcefully prevents breaking at white space no matter what (it also overrides width etc. properties)
table.pre td {
white-space: pre;
}
table.normal td {
white-space: normal;
}
<code>white-space: pre;</code>
<table class="pre">
<tbody>
<tr>
<td>1</td>
<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla posuere nisi at enim vehicula faucibus. Sed lobortis malesuada finibus. Nunc bibendum id erat nec aliquet. Aenean convallis gravida nisi dapibus facilisis. Proin gravida consectetur porta. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sodales odio maximus orci vulputate, non aliquet felis ornare. Nunc convallis orci eget urna laoreet, sit amet suscipit arcu interdum. Nam vel ante tellus.</td>
</tr>
<tr>
<td>2</td>
<td>Curabitur sed volutpat tortor, molestie faucibus justo. Praesent at massa vitae felis interdum ultricies ac at ante. Curabitur lobortis, urna nec sodales mattis, nibh velit rhoncus mauris, in sagittis odio eros ut velit. Mauris a cursus sem. Integer id varius nisi. Nullam posuere molestie blandit. Donec dapibus elementum ex sit amet hendrerit.</td>
</tr>
</tbody>
</table>
<code>white-space: normal;</code>
<table class="normal">
<tbody>
<tr>
<td>1</td>
<td>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla posuere nisi at enim vehicula faucibus. Sed lobortis malesuada finibus. Nunc bibendum id erat nec aliquet. Aenean convallis gravida nisi dapibus facilisis. Proin gravida consectetur porta. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sodales odio maximus orci vulputate, non aliquet felis ornare. Nunc convallis orci eget urna laoreet, sit amet suscipit arcu interdum. Nam vel ante tellus.</td>
</tr>
<tr>
<td>2</td>
<td>Curabitur sed volutpat tortor, molestie faucibus justo. Praesent at massa vitae felis interdum ultricies ac at ante. Curabitur lobortis, urna nec sodales mattis, nibh velit rhoncus mauris, in sagittis odio eros ut velit. Mauris a cursus sem. Integer id varius nisi. Nullam posuere molestie blandit. Donec dapibus elementum ex sit amet hendrerit.</td>
</tr>
</tbody>
</table>
To overwrite this via a user stylesheet and enable word-wrapping in GitHub, simply overwrite that rule on the <td>s:
#repo-content-turbo-frame .blob-code-content td.blob-code {
white-space: normal !important;
}
How do i position a centered text or logo (picture 2) at the bottom of the viewport similar to a footer? When the dropdownmenue (picture 3) opens the logo or text should move accordingly to the new height.
So the div below point 5 should dynamically change its height or get out of site in case.
I tried several solutions i googled prior but somehow all did not work like i wanted it to be.
If you know the height of the footer, then you could use min-height, absolute positioning and padding-bottom. However I'm going to assume the more difficult case in which you don't know the height.
<style>
* {box-sizing:border-box;}
.wrapper {min-height:100vh;display:flex;flex-direction:column;}
.main {flex:1 0 auto;}
.footer {background-color:yellow;padding:16px;font-weight:bold;flex:0 0 auto;}
</style>
<div class="wrapper">
<div class="main">
<h1>
Main
</h1>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In aliquet, nibh id placerat viverra, justo purus semper dolor, at lacinia eros mauris eu libero. In finibus a urna dapibus tempus. Aenean ipsum urna, tempor at lectus non, blandit feugiat quam. Donec sed ante orci. Integer laoreet est erat, a feugiat leo posuere sed. Mauris sit amet metus finibus, dapibus nunc ut, molestie erat. Nullam rhoncus sagittis lacus id finibus. Etiam sollicitudin nibh dui, a mollis nisl pharetra vitae. Suspendisse nec laoreet ipsum. Fusce sit amet tempor sem. Vestibulum consequat est in nisl aliquam ornare. Aliquam erat volutpat.
</p>
<p>
Sed vulputate nisl ac est eleifend bibendum. Nullam cursus at ex sit amet dignissim. Sed blandit pretium venenatis. Phasellus at ullamcorper nibh. Aenean nec lectus semper, efficitur diam in, luctus nisi. Phasellus in ligula congue, cursus nunc et, luctus mi. Suspendisse a leo luctus, molestie elit sed, venenatis sem. Nullam lobortis ante nec dictum elementum. Praesent aliquam orci quis molestie consectetur. Aliquam ornare a ipsum dapibus pulvinar. Morbi aliquet posuere ligula, vel volutpat dolor pellentesque vel. Vivamus non euismod leo. Duis feugiat velit a est tincidunt pulvinar. Proin blandit malesuada pulvinar. Nunc ut elementum ex, non vehicula tortor.
</p>
</div>
<div class="footer">
Footer
</div>
</div>
Change the height of your browser up and down to see how this works - the principle is a vertical flexbox that's at least the height of the screen, and a footer that's always at the bottom because the main content grows to fill any spare space.
I have a dynamic content inside a wrapper:
<div class="wrapper">
// Dynamic content
</div>
And what I want is something like this:
the image
Basically, I want to split the one-div content to two columns.
Is there anyway I can do this with pure CSS?
I must support all modern browsers, including IE-10-11 and Edge.
We can use CSS to do this, there is a property called column-count
The column-count CSS property breaks an element's content into the specified number of columns
.wrapper {
column-count: 2;
}
<p class="wrapper">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mi justo, venenatis sit amet iaculis nec, scelerisque eu sapien. Morbi porttitor ornare massa nec venenatis. Aenean a neque metus. Quisque venenatis metus diam, ut interdum magna bibendum ut.
Aliquam nec orci tincidunt, porttitor orci quis, condimentum ipsum. Morbi sed nunc quam. Aliquam egestas tincidunt diam, quis gravida diam elementum vitae. Morbi venenatis, tortor in efficitur consectetur, lectus metus aliquet arcu, in sagittis lectus
odio vitae ligula. Quisque luctus dignissim leo vitae commodo. Pellentesque condimentum, lectus eu venenatis ornare, sem tellus consequat diam, id semper urna lectus sed quam. Nulla faucibus sollicitudin lectus a ornare. Donec a venenatis tellus. Proin
imperdiet fermentum blandit. In sit amet lacinia neque. Phasellus luctus ultrices nulla, eu tempus arcu sodales eu. Pellentesque sit amet lacinia dui, vel gravida est.
</p>
The support is actually very good too, supporting IE 10+ and every other major browser.
.wrapper{
column-count: 2;
}
That should work with IE 10 and up
Using bootstrap:
<div class="row">
<div class="column"></div> /// Your dynamic DIV
<div class="column"></div> /// your dynamic DIV
</div>
I'll try and explain this challenge... I have three divs, ordered for mobile first in a bootstrap WordPress theme.
[1] NAV
[2] CONTENT
[3] SIDEBAR
This code, works fine:
<div class="container">
<div class="row">
<div class="col-md-4"><p>NAV</p></div>
<div class="col-md-6 col-md-pull-right" ><p>MAIN CONTENT : Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam et diam et erat imperdiet scelerisque ac a leo. Etiam eu ultrices tortor, a aliquet felis. Morbi sit amet placerat mi. Nulla feugiat id sem non faucibus. Nunc tortor turpis, faucibus non nisi sit amet, bibendum tincidunt arcu. Duis id risus porttitor, porttitor massa eget, elementum ligula. Proin ullamcorper, lacus quis porta luctus, dolor enim hendrerit massa, varius gravida est ipsum quis elit. Quisque ex felis, commodo a placerat non, egestas eu turpis. Praesent sit amet lobortis tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus porta nibh non erat suscipit, et rhoncus mauris finibus. In hac habitasse platea dictumst. Quisque quam mauris, sagittis ut orci eget, tempor sollicitudin nunc. Mauris consequat ex quis dolor viverra, ac dictum eros dapibus.</p></div>
<div class="col-md-4 col-md-pull"><p>SIDEBAR</p></div>
</div>
</div>
However, on full desktop view, the sidebar displays after the main content finishes, and I need it to display directly beneath the left hand side nav - i.e.
[1 ------ NAV -------] [2------------------CONTENT -----------------]
[3 ----SIDEBAR----] [2------------CONTENT CONTINUED-----]
------------------------- [2------------CONTENT CONTINUED-----]
Instead, it displays like this.
[1 ------ NAV -------] [2------------------CONTENT -----------------]
________________[2------------CONTENT CONTINUED-----]
________________[2------------CONTENT CONTINUED-----]
[3 ----SIDEBAR----]
I don't usually do advanced CSS like this, and have been let down by my contractor, if anybody could help, and at least let me know if this is possible or not that would be much appreciated.
Also this is my first post here, so apologies if this isn't in standard format etc.
Regards
Simon
The structure of my image and paragraphs is as follows:
<p class="All-Book-Text">Maecenas iaculis, ipsum at tempor placerat, orci ligula aliquam enim, sit amet sagittis turpis enim sit amet lorem. Praesent dapibus pretium felis, et tempus nibh posuere a.</p>
<div class="_idGenObjectLayout-3">
<div id="_idContainer062" class="ObjExpOpt-Images">
<img class="_idGenObjectAttribute-1" src="image/animal.png" alt="" />
</div>
</div>
<p class="All-Book-Text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam imperdiet elementum ex, a porttitor arcu vulputate vitae. Mauris ac finibus nisi. Etiam at tellus vitae quam pretium eleifend. Donec at dictum nisi, id condimentum dui. Donec in tortor ipsum. Etiam sit amet turpis vulputate, maximus erat in, lacinia leo. Cras placerat lobortis fermentum. Phasellus vulputate libero et pellentesque mattis. Aenean tristique ante egestas nibh aliquet, a sagittis sem aliquam. Aenean sit amet diam elementum, cursus arcu non, vehicula lorem. Sed vitae ante id augue consectetur euismod. Suspendisse ac metus ut tortor mollis semper eget eu mi. Vivamus eleifend leo at felis bibendum rutrum. Proin condimentum consectetur velit, at tristique elit accumsan vel.</p>
When the page renders, the text of the lower paragraph overlaps over the image. How can I prevent this and make sure that the distance between the image and the parapgraph is 5 px and no overlap occurs whatsoever. Thanks!
Here's a live demo with my problem http://jsfiddle.net/zvnjnxnf/
Everything looks ok here: JsFiddle
p {display: inline}
img {display: block}
first, you should remove all the style for All-Book-Text and _idGenObjectLayout-3
then add the following css :
._idGenObjectLayout-3{
padding : 5px;
}