How to align a script after a div size for every resolution? - alignment

So i have this div containing a contact script:
<div id="contactbox" style="">
<form enctype="multipart/form-data" method="post" action="http://www.response-o-
matic.com/mail.php" accept-charset="UTF-8">here's the script</form>
</div>
</div>
I'm wondering if there is any way to align a script after the wrapper size for every resolution.Because i set the position of the script in percentage and on my resolution it looks centered in wrapper.But on a bigger resolution for example it's not working,it's a little bit in left side,that means the script goes after the html size because it focuses after it and it goes in the middle.
I know that if i set the wrapper with:
.wrapper
{
text-align:center;
}
then every texts from the wrapper will be centered after his size,but with scripts isnt working.So is there any way?

Related

is vertical alignment with images in bootstrap 5 handled differently to text, buttons or other components?

I've run into some issues with vertical alignment for an image (using bootstrap 5).
In the index.html I've created a number of thick strips that alternate being colour and then white, with each about 800 px each. I've set the height of each strip in css to 800px.
I'm trying to place an image in each strip and the image sizes will differ in width but none will be greater than 800 px in height. The image doesn't seem to be vertically centred when I used the suggestions from the post below:
Bootstrap Center Vertical and Horizontal Alignment
There is this example given https://www.codeply.com/p/0VM5MJ7Had
And the div tag used to center everything is
<div class="d-flex flex-column min-vh-100 justify-content-center align-items-center">
In the tag above if the min-vh-100 is removed then the content just moves up to the top of the screen even though it's still justify-content-center and align-items-center.
I'm still struggling to get my head around how vertical alignment works and the relationship between containers and rows to aligning an image vertically.
<!-- color background -->
<div id="first_strip" >
<img src="../images/" class="img-fluid" alt="" />
</div>
<!-- white background -->
<div id="second_strip">
<img src="../images/" class="img-fluid" alt="" />
</div>
<!-- color background -->
<div id="third_strip" >
<img src="../images/" class="img-fluid" alt="" />
</div>
etc.

Multi line text in LitRenderer in vaadin grid

Does anyone maybe have an example of a LitRenderer with multiple lines of potentially wrapped text in a vaadin grid please?
All the examples in the documentation just have a bold line and a small single line of text underneath. I have tried to create a bold line and then a multi line text paragraph underneath it, but I cant get the grid to render this properly.
The text should ideally change width responsively with flex grow, wrap accordlingly and potentially truncate if no space is available.
Edit:
I think I got this working as follows:
grid.addColumn(TemplateRenderer.<SubProductTypeOption>of("""
<vaadin-vertical-layout style="line-height: var(--lumo-line-height-m); height: 175px; cursor: pointer;">
<span> [[item.name]] </span>
<span style="font-size: var(--lumo-font-size-s); color: var(--lumo-secondary-text-color); white-space:normal;">[[item.description]]</span>
</vaadin-vertical-layout>
""")
.withProperty("name", SubProductTypeOption::getName)
.withProperty("description", SubProductTypeOption::getDescription)
).setFlexGrow(1);
Seems to work so far...

What is the class for min width using Bootstrap 5?

I looked at the documentation for Bootstrap 5 but I can't seem to find the min-width class using pixels? Is there any?
https://v5.getbootstrap.com/docs/5.0/utilities/sizing/
Bootstrap CSS Grid layout does the heavy lifting in terms of setting responsive breakpoints.
Each view/page/front-end element can be divided into 12 parts. and you can choose how much space a container takes out of 12 vertical columns.
Bootstrap 5 gives you 6 breakpoints pre-defined, with the following syntax
col-xs-{number-between-1-to-12} width <= 540px
col-sm-{number-between-1-to-12} max-width = 540px
col-md-{number-between-1-to-12} max-width = 720px
col-lg-{number-between-1-to-12} max-width = 960px
col-xl-{number-between-1-to-12} max-width = 1140px
col-xxl-{number-between-1-to-12} width <= 1400px
Example 1: You get a parent div with 2 child divs, these children will take equal divided space inside for all screen sizes
<div id="i-am-a-parent-div">
<div class="col-6"> This takes First Half the Space inside parent element</div>
<div class="col-6"> This takes Second Half the Space inside parent element</div>
</div>
Example 2: The Children divs will share 6/12 space each till max-width=540, but then they will change space occupation to 4/12 and 8/12 respectively.
NOTE: I've added two separated classes for each child div, you can add as many as needed for each breakpoint.
<div>
<div class="col-sm-6 col-md-4"> This takes First Half (6/12) the Space inside parent element till max-width = 540px,
BUT it will only take One-Thirds (4/12) the space between 540px & 768px </div>
<div class="col-sm-6 col-md-8"> This takes Second Half (6/12) the Space inside parent element till max-width = 540px,
BUT it will only take Two-Thirds (8/12) the space between 540px & 768px </div>
</div>
If this doesnt satisfy what you need to do, Then there are more customization options to their breakpoints, Feel free to checkout: https://v5.getbootstrap.com/docs/5.0/layout/grid/#grid-options
Let me know if this helps you out!

Angular Material vertical percentage space

How can I make one div to take certain percent of parent space verically?See the code below:
<div layout="column">
<div id="div1" flex="70%"></div>
<div id="div2" flex="30%"></div>
</div>
I want to make div1 70% height and div2 30% height of parent div. But it does not work. Div 1 and div 2 collapsed. But if the parent layout is row, it works fine---div1 takes 70% percent space horizontally.
I think you need to make the following modifications:
Specify a "height" to your outside div. This could be a percentage or pixels.
Do not use the % sign with the flex attribute
See this codepen: http://codepen.io/sebastiengiroux/pen/jPovxG
<div layout="column" style="height: 100%;">
<div id="div1" flex="70" style="background-color:red;"></div>
<div id="div2" flex="30" style="background-color:blue;"></div>
</div>
If you look into Layout docs https://material.angularjs.org/latest/layout/introduction
there is this statement that I think is relevant to your problem.
The flex attribute value is restricted to 33, 66, and multiples of five.
For example: flex="5", flex="20", flex="33", flex="50", flex="66", flex="75", ....
So I guess if you use allowed values, you can achieve results that you need. For example using 66 and 33.

Why does the height of the content area of an inline element larger than the value specified by font-size?

In a document like:
<p class="wrapper">
<span class="ref">
<span class="text">English</span>
</p>
the following rules are applied:
.wrapper {
background:green;
position:relative;
padding-left:20px;
font-family:Times;
}
.text {
line-height:1;
background:blue;
font-size:80px;
}
.ref {
position:absolute;
left:5px;
width:10px;
height:80px;
background:black;
}
In Chrome (Version 22.0.1229.79) or IE9, the background of the span element containing 'English' seems to have a height larger than font-size, yet in Firefox (13.0.1) the height equals font-size. (See the output)
Can anybody explain this?
I thought the height of the content area would have the same value as specified by font-size.
Here's a diagram showing the various reference lines available when rendering text:
As you can see, there are many choices. It seems like Firefox is using a different baseline than Chrome/IE when rendering.

Resources