logo
Tags down

shadow

Grid properties not working on elements inside grid container


By : MahdiChatri
Date : October 17 2020, 01:08 AM
hope this fix your issue The scope of a grid formatting context is limited to a parent-child relationship.
This means that a grid container is always the parent and a grid item is always the child. Grid properties work only within this relationship.
code :


Share : facebook icon twitter icon

center grid elements in container (960 grid)


By : utech1
Date : March 29 2020, 07:55 AM
this will help They are not meant to be centered at the first place - the float property arranges elements from left to right, filling up the width of the entire container (left to right) until it exceeds the width of the container, and the continues on the next line. Therefore all elements will be flushed towards the left and not centered.
In short, you can't center floated elements unless you set display: inline-block on them (and remove the float), and then text-align: center on the parent element. To mitigate the issue where a whitespace is present between each inline-block elements, set the font size in the parent container to 0, and the redeclare the desired font-size in the children:
code :
.container {
    background-color: #eee;
    text-align: center;
    font-size: 0; /* To remove space between inline-block elements */
    width: 100%; /* or 960px, or any other value you desire */
}
.widget {
    background-color: #aaa;
    display: inline-block;
    width: 25%;
    font-size: 16px; /* Reset font size in widgets */
}
<div class="container">
    <div class="widget">Widget 1</div>
    <div class="widget">Widget 2</div>
    <div class="widget">Widget 3</div>
</div>

Change the color of elements inside a Grid once a mouse hovers the Grid


By : user7281614
Date : March 29 2020, 07:55 AM
With these it helps Your problem is that you specified the fill on the path element.
NOTE: I 'fixed' the Data by added ",41.3334" to it.
code :
<Path x:Name="path" Stretch="Fill" Fill="{DynamicResource MarkerBrush}" Data="M 65.3334,41.3334C 65.3334,45.0133 62.3467,48 58.6667,41.3334" Grid.Column="0" />
<Path x:Name="path" Stretch="Fill" Data="M 65.3334,41.3334C 65.3334,45.0133 62.3467,48 58.6667,41.3334" Grid.Column="0" />
<Style x:Key="button_special_hover" TargetType="{x:Type Grid}">
    <Setter Property="Background" Value="Transparent"/>
    <Style.Resources>
        <Style TargetType="{x:Type TextBlock}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Grid},
                                    Path=IsMouseOver}" Value="True">
                    <Setter Property="Foreground" Value="White"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        <Style TargetType="{x:Type Path}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Grid},
                                    Path=IsMouseOver}" Value="True">
                    <Setter Property="Fill" Value="White"/>
                </DataTrigger>
            </Style.Triggers>
            <!-- "All I did was add this line below" -->
            <Setter Property="Fill" Value="{DynamicResource MarkerBrush}"/>
        </Style>
    </Style.Resources>
</Style>

Equal height of elements inside grid item with CSS grid layout


By : Shocking Boy Harsh
Date : March 29 2020, 07:55 AM
it helps some times I have a sequence of articles inside a div of 4+ length, without any rounding row tag. I need to represent it as a table of 3 articles (columns) per row, probably with display: grid. Every article has a header, a section and a footer. ,
Is it even possible?
code :
.container article {
  display: contents;
}
.container {
  display: grid;
  grid-column-gap: 1em; /* horizontal gap between articles */
  grid-template-columns: repeat(3, 1fr);

  grid-template-areas: "header1 header2 header3" 
                       "section1 section2 section3"
                       "footer1 footer2 footer3"
                       "header4 header5 header6" 
                       "section4 section5 section6"
                       "footer4 footer5 footer6"
}
article:nth-child(1) header {
  grid-area: header1;
}
article:nth-child(2) header {
  grid-area: header2;
}
article:nth-child(3) header {
  grid-area: header3;
}
article:nth-child(4) header {
  grid-area: header4;
}
article:nth-child(1) section {
  grid-area: section1;
}
...
article:nth-child(4) section {
  grid-area: section4;
}
article:nth-child(1) footer {
  grid-area: footer1;
}
...
article:nth-child(4) footer {
  grid-area: footer4;
}
article:nth-child(n + 4) header {
  margin-top: 1em;
}
body {
  width: 100%;
  max-width: 1024px;
  margin: auto;
}

.container {
  display: grid;
  grid-column-gap: 1em;
  grid-template-columns: repeat(3, 1fr);
  grid-template-areas: "header1 header2 header3" 
                      "section1 section2 section3"
                        "footer1 footer2 footer3"
                        "header4 header5 header6" 
                      "section4 section5 section6"
                        "footer4 footer5 footer6"
}

.container article {
  display: contents;
}

article header {
  background-color: #eeeeee;
}

article section {
  background-color: #cccccc;
}

article footer {
  background-color: #dddddd;
}

article:nth-child(n + 4) header {
  margin-top: 1em;
}

article:nth-child(1) header {
  grid-area: header1;
}
article:nth-child(2) header {
  grid-area: header2;
}
article:nth-child(3) header {
  grid-area: header3;
}
article:nth-child(4) header {
  grid-area: header4;
}
article:nth-child(1) section {
  grid-area: section1;
}
article:nth-child(2) section {
  grid-area: section2;
}
article:nth-child(3) section {
  grid-area: section3;
}
article:nth-child(4) section {
  grid-area: section4;
}
article:nth-child(1) footer {
  grid-area: footer1;
}
article:nth-child(2) footer {
  grid-area: footer2;
}
article:nth-child(3) footer {
  grid-area: footer3;
}
article:nth-child(4) footer {
  grid-area: footer4;
}
<div class="container">
    <article>
        <header>
            <h2>Header</h2>
            <h2>Header</h2>
        </header>
        <section>
            <p>Content</p>
        </section>
        <footer>
            <p>Footer</p>
        </footer>
    </article>
    <article>
        <header>
            <h2>Header</h2>
        </header>
        <section>
            <p>Content</p>
            <p>Content</p>
            <p>Content</p>
            <p>Content</p>
            <p>Content</p>
        </section>
        <footer>
            <p>Footer</p>
            <p>Footer</p>
        </footer>
    </article>
    <article>
        <header>
            <h2>Header</h2>
        </header>
        <section>
            <p>Content</p>
            <p>Content</p>
            <p>Content</p>
        </section>
        <footer>
            <p>Footer</p>
        </footer>
    </article>
    <article>
        <header>
            <h2>Header</h2>
        </header>
        <section>
            <p>Content</p>
            <p>Content</p>
            <p>Content</p>
            <p>Content</p>
        </section>
        <footer>
            <p>Footer</p>
            <p>Footer</p>
        </footer>
    </article>
</div>
grid-template-areas: repeat("header1 header2 header3" 
                           "section1 section2 section3"
                           "footer1 footer2 footer3")
article:nth-child(3n + 1) header {
  grid-area: header1;
} 

css transitions not working for css grid-column and grid-row properties?


By : jarinko.chie
Date : March 29 2020, 07:55 AM
it helps some times I added a width for your items. Then for the item hover I added a width, height, position absolute, transition, and a margin to center it. On hover we make the container cover the width of all 4.
The CSS
code :
<style type="text/css">
*{
padding: 0;
margin: 0;
text-decoration: none;
}
#cover {
display: grid;
height: 100vh;
grid-template-columns: repeat(4,1fr);
grid-template-rows: 100px auto auto 100px;
grid-gap: 5px;
grid-template-areas: 
". . . ."
". item_1 item_2 ."
". item_3 item_4 ."
". . . ."
}
.item {
width:100%;
text-align: center;
vertical-align: middle;
font-size: 5em;
}

.item:nth-child(1) {
grid-area: item_1;
width:80%;
background-color: aqua;
transition:ease-in-out 1s;
margin-left:10%;
}
.item:nth-child(2) {
grid-area: item_2;
background-color: gray;
transition:ease-in-out 1s;
width:80%;
margin-left:10%;
}
.item:nth-child(3) {
grid-area: item_3;
background-color: lightgreen;
transition:ease-in-out 1s;
width:80%;
margin-left:10%;
}
.item:nth-child(4) {
grid-area: item_4;
background-color: lightsalmon;
transition:ease-in-out 1s;
width:80%;
margin-left:10%;
}

.item:hover {
grid-column: 2 / 4;
grid-row: 2 / 4;
width:80%;
height:80%;
position:absolute;
top: 0px;
z-index: 1000;
transition:ease-in-out 1s;
margin-left:10%;
opacity:0.7;
}
</style>
<body>
<div id="cover">
<div class="item">One</div>
<div class="item">Two</div>
<div class="item">Three</div>
<div class="item">Four</div>
</div>
</body>

Xamarin set IsVisible of a button inside a Grid based on multiple bound properties in the same Grid.Row without editing


By : Daniel
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I have a button that can appear in each row of a grid. , You can also binding the property IsVisible to ViewModel
code :
<StackLayout Grid.Column="2">
   <Button Text="Do Something" 
           IsVisible="{Binding isVisible}" />
</StackLayout>
public class TestClass
{
  public string? Prop1 { get; set; }
  public string? Prop2 { get; set; }      
  public bool isVisible { get; private set; }

  public TestClass(string? p1,string?p2)
  {
      if(p1==null||p2==null)
      {
        isVisible = false;
      }
      else
      {
        isVisible = true;
      }
  }

}
var testClasses = new List<TestClass>();
testClasses.Add(new TestClass("1","1") );
testClasses.Add(new TestClass(null,"2") );
testClasses.Add(new TestClass("1",null));
TestClasses = new ObservableCollection<TestClass>(testClasses);
<Button Text="Do Something" IsVisible="{Binding , Converter={StaticResource NullBooleanConverter}}" />
Related Posts Related Posts :
  • Count <tr> HTML tag grouped by their @class attribute name in XPath
  • Scraping html text into table with delimiters that do not have a clear pattern using R (rvest)
  • Sorting a complex Table w/nestled tables (but w/out tablesorter)
  • ElementUI : right submenu appears truncated (CSS)
  • Bigger logo without affecting other elements in the navbar
  • Centered Navigation -- Sub Menus are Off-Center
  • Decoding a combination of windows-1252 and quoted printable HTML
  • WebStorm HTML formatting error - Expecting newline or semicolon
  • color overlay on a div behavior
  • Footer not displaying at bottom of page
  • Page body does not extend to bottom of display when zooming out
  • Materialize- A Dropdown inside a tab
  • Bootstrap 4 jacked up on IE 10
  • Overlay Static Images on R Leaflet htmlwidget
  • document setAttribute ngModel Angular
  • web-design: WHY doesn't :before scss work nested inside li unless I put it seperated?
  • Can't get first instance of CSS element to line up correctly
  • Image with strange Padding within Table
  • Why can't i add a new slide to my pure css slideshow?
  • Get Xpath for href from a tag based on span tag value
  • ColdFusion convert hidden form variables to a structure
  • Corner DIV with transparent filling
  • CSS :before width
  • How to combine many CSS animation nth-of-type selectors into one?
  • Vertical-align play button with mobile navbar-button
  • VBA - Navigating HTML table with IF function
  • Bootstrap4-styled <select> element rendering incorrectly
  • Adding an element to the DOM with Chrome developer tooling?
  • Div Appearing over Heading
  • How to Have Google Not Show Recent Inputs
  • What's the state of OffscreenCanvas's support for 2d context?
  • Can't find a way to correct my input text box
  • Flexbox order property not working to order elements?
  • visibility: visible not working
  • CSS ul li with display:inline-block but position is wrong
  • How to make my user's blogs visible in search engines?
  • How to change the order of ancestors of flex child elements
  • Bootstrap navbar toggler icon (hamburger) size
  • How to make a drop down menu from an icon in a navbar?
  • Insert webpage inside a .vsdx project
  • New line after <li> bullet
  • "birthPlace" expects "Place", but I don’t have a full address
  • Drawing in canvas with react doing weird things when rotating
  • Why isn't the last row of buttons on my calculator not aligned as all the rest of the buttons are?
  • link inside a p tag in react
  • shadow
    Privacy Policy - Terms - Contact Us © soohba.com