I have a stepper, in which the active step is highlighted in blue color.
Working Snippet:
.inline-flex {
display: inline-block;
border-bottom: 2px solid black;
padding-left: 100px;
}
.inline-flex:first-child {
padding-left: initial;
}
.active {
border-bottom: 2px solid blue;
}
<div class="steps">
<div class="inline-flex active">Registration</div>
<div class="inline-flex active">Basic Information</div>
<div class="inline-flex">Professional Information</div>
<div class="inline-flex">Others</div>
</div>
To make the active indication, we are making it upto the current step title.
Requirement:
The requirement is that the progress bar should split up equally for 100% width.
In the above example there are 4 steps, So the active indication should be there for
-> 25% for Registration (If user is in Step 1)
-> 50% for Basic Information (If user is in Step 2)
I am trying to achieve it by using padding left and it only works until the title ends.
So kindly please help me to make the progress bar to split up for total width.
Expected Output:
Active in Step 1 Registration Step
Registration Basic Information Step 3
-------blue--------black------black-----black---
The easiest way to make the bars to have the same width is adapting their total percentage to a value less than 100%. For example:
.inline-flex {
display: inline-block;
border-bottom: 2px solid black;
width: 24%;
}
When using the inline-block display, the html space and line count as a little percentage of the total width (html-css shenanigans...), so you could write the html like this:
<div class="steps">
<div class="inline-flex active">Registration</div><div class="inline-flex active">Basic Information</div><div class="inline-flex">Professional Information</div><div class="inline-flex">Others</div>
</div>
Related
I have a text composed by "< p >" and "< ul >< li >", inside a box.
There's no problem with the lists, but the words in the paragraphs are splitting in half when they reach the padding of the box.
my text
<style>
#media (min-width: 768px)
<style>
.col-md-12 {
flex: 0 0 100%;
max-width: 100%;
}
.alert {
position: relative;
padding: 0.75rem 1.25rem;
margin-bottom: 1rem;
border: 1px solid transparent;
border-radius: 0.25rem;
}
.alert-warning {
color: #856404;
background-color: #fff3cd;
border-color: #ffeeba;
}
.garrigues_RemindersAML__Exvyp {
position: relative;
padding: 0.75rem 1.25rem;
margin-bottom: 1rem;
border: 1px solid transparent;
border-radius: 0.25rem;
color: #0c5460;
border-color: #ffeeba;
text-align: justify;
}
</style>
<div class="row" style="margin-top: 15px;">
<div class="alert alert-warning garrigues_RemindersAML__Exvyp col-md-12">
<p style="font-size: 17px;margin-left:0px;">Reminder </p>
<p> A priori, it is not necessary to request any document from this type of clients. The following documents must be obtained from public sources of information, and included in the AML questionnaire:</p>
<ul>
<li>Documentation proving that it is one of the clients considered low risk.</li>
<li>Documentation accrediting the activity (for example, annual accounts or screenshot of the website).</li>
</ul>
<p> If the customer is a subsidiary or branch of a financial entity or of listed companies whose securities are admitted to trading in a market regulated in the EU or Equivalent Third Countries, it must be justified that they belong (directly or indirectly in more than 50% to the financial or listed entity).</p>
<p> This client has LOW RISK and, therefore, applies SIMPLIFIED MEASURES OF DILIGENCE DUE.</p>
</div>
</div>
I've tried everything to prevent them to break, but there's just 2 results: they break, or the paragraph overflows outside the box.
I've tried all the options with white-space, word-break, overflow-wrap, overflow, display, width, margin, height... And the result is always the same: they break or they overflow.
Is there a way to prevent them from breaking, placing them in the next line, instead of overflowing them?
Thank you in advance.
Edit: each paragraph comes from a database, and then is renderized by a component in a React web application, the code is not as simple as it seems.
The text can't break between the words because there are only s (which is for 'non breaking space') used. Use normal space characters.
p {
background: teal;
width: 150px;
margin: 1em;
}
<p>This text has a long_long_word to test the issue</p>
<p>This text has a long_long_word to test the issue</p>
Have you tried "word-wrap: break-word;"?
I have tried this and its working.
First, im new so dont give me a hard time ;)
i have a problem with styling my foreach. What I want is that if I hover on the row. It only returns single line bottom and top border.
In this case when I hover on the next row the bottom top border from other rows are there creating a 2px border. I tried many things margin-top:-1px etc... some gave me a better result but not the final one.
.frameregels{
border-bottom:1px solid #e1e1e1;
border-top:1px solid #e1e1e1;
}
.frameregels:nth-child(odd){
background-color:#FFFFFF;
}
.frameregels:nth-child(even){
background-color:#f9f9f9;
}
.frameregels:hover{
background-color:#ecf5f9;
border-color:#66afe9;
}
<div class="xxlarge-12 xlarge-12 large-12 medium-12 small-12 columns frameregels">
<div class="xxlarge-1 xlarge-1 large-2 columns large-down-hidden">[artikelnr]</div>
<div class="xxlarge-11 xlarge-11 large-10 columns large-down-hidden">[omschrijving]</div>
</div>
<div class="xxlarge-12 xlarge-12 large-12 medium-12 small-12 columns frameregels">
<div class="xxlarge-1 xlarge-1 large-2 columns large-down-hidden">[artikelnr]</div>
<div class="xxlarge-11 xlarge-11 large-10 columns large-down-hidden">[omschrijving]</div>
</div>
<div class="xxlarge-12 xlarge-12 large-12 medium-12 small-12 columns frameregels">
<div class="xxlarge-1 xlarge-1 large-2 columns large-down-hidden">[artikelnr]</div>
<div class="xxlarge-11 xlarge-11 large-10 columns large-down-hidden">[omschrijving]</div>
</div>
margin-bottom:-1px is the completely right idea, however you need a few more things for that to work:
make sure you don't apply it to the last element to retain a clean bounding box of your list
position the elements in a way that accepts a z-index property so that you can shift the element you're hovering in the foreground. If you don't do this, you will change the color of your border, but the next element's border is just going to overlay it.
In practice, this is how it works (padding added for beauty):
.frameregels {
border-bottom: 1px solid #e1e1e1;
border-top: 1px solid #e1e1e1;
padding: 5px 0;
position: relative;
z-index: 0;
}
.frameregels:not(:last-child) {
margin-bottom: -1px;
}
.frameregels:nth-child(odd) {
background-color: #ffffff;
}
.frameregels:nth-child(even) {
background-color: #f9f9f9;
}
.frameregels:hover {
background-color: #ecf5f9;
border-color: #66afe9;
z-index: 1;
}
<div class="frameregels">
<div>[artikelnr]</div>
<div>[omschrijving]</div>
</div>
<div class="frameregels">
<div>[artikelnr]</div>
<div>[omschrijving]</div>
</div>
<div class="frameregels">
<div>[artikelnr]</div>
<div>[omschrijving]</div>
</div>
<div class="frameregels">
<div>[artikelnr]</div>
<div>[omschrijving]</div>
</div>
https://jsfiddle.net/pepgw4cz/1/
This is a typical article list scenario, every item has its image, title, introtext and created time. As you can see in the 2nd item, where the title is longer, the table exceeds its designated width. This could be easily solved by flex, but my client is using a 2011 laptop with IE9 and she wouldn't let go.
So I am stuck with table. The container's width is unknown(fit mobile screen) as well as the itemBody's width(actually, setting them to a fixed width doesn't change anything.), and the item Title has to be limited to one line(white-space:nowrap), which contributes to the problem.
Here is the codes, I copy it from my site so the structure looks a little wierd, but look at the fiddle and you will get the idea
<ul>
<li class="card " k2id="84">
<div class="moduleItemImageContainer">
<a class="moduleItemImage">
</a>
</div>
<div class="moduleItemBody">
<div class="moduleItemBodyContainer">
<span class="moduleItemDateCreated">2016-06-11</span>
<a class="moduleItemTitle">Norm</a>
<div class="moduleItemIntrotext">
人民大会堂国庆宴会的细节 </div>
</div>
</div>
</li>
<li class="card " k2id="83">
<div class="moduleItemImageContainer">
<a class="moduleItemImage">
</a>
</div>
<div class="moduleItemBody">
<div class="moduleItemBodyContainer">
<span class="moduleItemDateCreated">2016-06-11</span>
<a class="moduleItemTitle">Looooooooong Title Long titleLooooooooong Title Long titl</a>
<div class="moduleItemIntrotext">
人民大会堂国庆宴会的细节 </div>
</div>
</div>
</li>
</ul>
<style>
li {
width: 100%;
list-style: none;
display: table;
margin-bottom: 16px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.8)
}
li>* {
display: table-cell;
vertical-align: top
}
div.moduleItemImageContainer{width:1%}
a.moduleItemImage {
display: block;
background-image: url('http://placehold.it/100x100');
width: 100px;
height: 100px;
}
a.moduleItemTitle{white-space:nowrap;overflow:hidden;display:block}
div.moduleItemBody {
padding: 16px;
}
div.moduleItemBodyContainer{
height:68px;overflow:hidden
}
span {
float: right
}
ul {
width: 500px
}
</style>
So, how to prevent table from behaving like this?
just give your div.moduleItemBody a max-width:1px; DEMO
and if you want your title to break in multiple lines if it is too long then remove white-space: nowrap; from a.moduleItemTitle DEMO
<table style='table-layout:fixed'>
For those who use bootstrap, please you can add a class class="text-wrap" on the cells.
This will automatically give the required width to the table cells according to the data its holding.
It's mostly in the title. I am displaying products in divs on my website. On hover, I make them increase in size by applying a margin of -15px to give them a nice hover effect. When I hover over any of them, it is fine except for the right-most ones, as it pushes the products below it away into the Bootstrap row below. Here are images:
Good (hover over a middle one):
Bad (hover over the right-most one):
Here is the code:
Search results page:
<div id="search-results">
<div data-bind="template: { name: 'product-template', foreach: allProducts }"></div>
</div>
Product template:
<script type="text/html" id="product-template">
<div class="col-sm-6 col-lg-2" style="margin-top:20px; padding: 25px;">
<div class="product-item">
<div data-bind="style: { backgroundImage: 'url(\'../../the_vegan_repository/product_images/' + product.imagePath + '\')' }"
style= "height: 160px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
color: white;
background: center no-repeat;
background-size:cover;
vertical-align:bottom;">
</div>
<div style="height: 110px; padding: 10px; background: #fc4747;">
<h6 class="medium-text" data-bind="text: product.brand" style="text-transform: uppercase; color: white; margin-top:0; margin-bottom:5px;"></h6>
<h6 class="medium-text" data-bind="text: product.name" style="text-transform: uppercase; color: white; margin-bottom:5px;display: inline;"></h6>
</div>
</div>
</div>
</script>
CSS:
div.product-item:hover {
margin: -15px;
}
div.product-item {
border: 5px solid #fc4747;
border-radius: 15px;
height: 240px;
overflow: hidden;
cursor: pointer;
}
How do I stop the Bootstrap grid system from pushing the bottom row into the row lower?
on hover, I make them increase in size by applying a margin of -15px
Use transform: scale(x); instead of margin: -15px; as transforms do not affect the box-model of the element.
CSS Transforms Module Level 1:
Note: Transformations do affect the visual layout on the canvas, but have no affect on the CSS layout itself. This also means transforms do not affect results of the Element Interface Extensions getClientRects() and getBoundingClientRect(), which are specified in [CSSOM-VIEW].
If you want to move it up by a certain amount, use transform: translateY(-15px) instead of changing the margin on the div.product-item:hover class. To move it in a context that does not interrupt the rest of the document. Or you can use transform: scale(1.2) to make things bigger.
The problem is that it's actually changing the dimentions of the div when you change the margin which in turn affects others. Check out this link . It gives an example on how to give such zoom effect.
Creating a Zoom Effect on an image on hover using CSS?
Please check the fiddle: http://jsfiddle.net/C23g6/1255/
I want the last child (7777) border top to be display none.
I tried but i couldn't get please give me solution.
Only through css
CSS
.common.true{
display: block;
border-top: 1px solid red;
}
.common{
display: none;
}
.true:last-child{
border-top: none;
}
I dont want the last child border not to be displayed. But not using nth child. some other way
First thing, If you do display: none of last element then how can you use css on that element(hidden element).
If you want to get Id or class (attribute) to perform action on that, you should choose js or jquery.
Second thing, the last-child would be 8888, but you want to do with second last-child, then use this, it may work :
.common:nth-last-child(2){
border-top:none !important;
}`enter code here`
You have a basic mistake in the HTML.Your last child in HTML is 8888 and you want to hide border-top of 7777.Use the following:
<div id="my-section">
<div class="common true">1111</div>
<div class="common">2222</div>
<div class="common true">3333</div>
<div class="common true">4444</div>
<div class="common true">5555</div>
<div class="common true">6666</div>
<div class="common true">7777</div>
<div class="common">8888</div>
</div>
.common.true{
display: block;
border-top: 1px solid red;
}
.common{
display: none;
}
.true:last-child{
border-top: none;
}
#my-section .common:nth-last-child(2){
border-top:none !important;
}
I have added a new css selector,which hide the border of 2nd last child.