Make separator div same height as maximal neighbour div height - html

How with help of css and html i could do this:
i have 3 div's, and i have separator between them, and this separator, and text-area div must be not 65px as in my example, but maximal height div (in example this is first div), for example if there i have 2 lines only, i will have smaller by height div, and separator must be same height (maximal). How could i do this... didn't have any ideas(
http://jsfiddle.net/crjsg/
<div class="introtext-text-area">
<div class="introtext-separator"></div>
<div class="introtext">
here is example text of test example with 3 <br>lines
</div>
<div class="introtext-separator">some text</div>
<div class="introtext"></div>
<div class="introtext-separator"></div>
<div class="introtext"></div>
</div>
css:
.introtext-text-area {
height: 65px;
width: 690px;
margin: 8px 0 0 0;
}
.introtext-separator {
width: 3px;
height: 65px;
float: left;
border: none;
background-color: red;
margin: 0 0 0 -1px;
}
.introtext {
width: 211px;
height: 58px;
float: left;
padding: 0 8px 0 8px;
border: none;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
text-align: left;
text-shadow: 0px 0px 1px #c2c2c2;
word-wrap: break-word;
}
how could i set automatical height for text-block and separator, and this height must be same for 3 text div's and it's separators.

You can use display:table and borders :
<div class="introtext-text-area">
<div class="introtext">
here is example text of test
example
</div>
<div class="introtext">
some text
</div>
<div class="introtext">
some text
</div>
</div>
.introtext-text-area {
display:table;
border-right:solid red;
}
.introtext {
width: 211px;
padding:5px;
display:table-cell;
border-left:solid red;
}

Use these css defintions:
.introtext-text-area {
overflow: hidden;
width: 100%;
margin: 8px 0 0 0;
}
.introtext-separator {
float: left;
border: none;
margin: 0 0 0 -1px;
height: 100%;
}
.introtext {
width: 211px;
float: left;
padding: 0 8px 0 8px;
height: 100%;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
text-align: left;
text-shadow: 0px 0px 1px #c2c2c2;
word-wrap: break-word;
}
.bordered {
border-left: 3px;
border-left-color: red;
border-left-style: solid;
margin-bottom: -99999px;
padding-bottom: 99999px;
}
Add the handy .bordered class to each of your divs:
<div class="introtext-separator bordered"></div>
<div class="introtext bordered">
The trick is that the parent div has overflow:hidden and the bordered class has really large paddings.
Forked fiddle

Related

Single Word is out of Div in chrome but not on mozilla

I'm trying to make a circular div with a single letter in it. It worked fine on Ubuntu(16.04)-Mozilla, but now the text is out of div in Windows10-Chrome.Please see this image
Here is the code: HTML:
<div class="Try"><p style="font-family: Bungee; font-size: 8mm;">A</p></div>
CSS:
.Try p,(some other Classes which works fine){
width: 10mm;
height: 10mm;
border-radius: 100%;
background: rgba(0,0,0,0.25);
color: #fff;
text-align: center;
margin: 10px;
display: block;
float: right;
bottom: 0;
box-shadow: 3px 3px 5px black;
right: 0;
bottom: 0;
position: fixed;
margin-right: 60mm;
word-wrap: break-word;
}
https://jsfiddle.net/SamX13/L1jtjznr/ <--- this is the code reproducing problem
In Windows, the browsers seem to think that the line height of the Bungee font is higher than in Linux. I don't know what causes it, but the solution is to set the line height explicitly in the css.
.try p, .abc p, .xyz p {
width: 10mm;
height: 10mm;
border-radius: 100%;
background: rgba(0, 0, 0, 0.25);
color: #fff;
text-align: center;
margin: 10px;
float: right;
bottom: 0;
box-shadow: 3px 3px 5px black;
right: 0;
bottom: 0;
position: fixed;
margin-right: 60mm;
word-wrap: break-word;
line-height: 1cm; /* new */
}
.try p {
margin-bottom: 42mm;
border: 2px solid red;
}
.abc p {
margin-bottom: 25mm;
}
.xyz p {
margin-bottom: 8mm;
}
<link href="https://fonts.googleapis.com/css?family=Bungee|Permanent+Marker|Electrolize|Yellowtail" rel="stylesheet">
<div class="try">
<p style="font-family: 'Bungee'; font-size: 8mm;">A</p>
</div>
<div class="abc">
<p style="font-family: 'Permanent Marker'; font-size: 8mm;">B</p>
</div>
<div class="xyz">
<p style=" font-size: 8mm; font-family: 'Electrolize';">C</p>
</div>
(Note that I also reduced the bottom margins a bit to fit the whole thing in an unexpanded snippet. So don't copy everything back to your CSS, only the new line.)

Inner div pushes paragraph outside outer div

I have a div called insidenextcontent2.
This is just a div that colors a section.
In this div I have another div called bottle1, which is a geometrical shape(supposed to be the top of a bottle).
Also, I have a paragraph which I want to position besides this geometrical shape. However, the paragraph is placed below the whole div(insidecontent).
How can I fix this? I want the text to be inside the outer div, besides the inner div.
.insidenextcontent2 {
margin-top: 10%;
width: 100%;
height: 15%;
background: #EEFA0F;
}
.bottle1 {
margin-left: 30%;
border-top: 97px solid black;
border-left: 35px solid transparent;
border-right: 35px solid transparent;
height: 0;
width: 150px;
}
#webpara {
color: black;
margin-left: 50%;
font-family: 'Fjalla One', sans-serif;
}
<div class="insidenextcontent2">
<div class="bottle1"></div>
<p id="webpara">Web &amp app development</p>
</div>
place your paragraph in a div alongside the bottle div.
add display: flex to your containing div.
https://jsfiddle.net/m08paL1d/2/
<div class="insidenextcontent2">
<div class="bottle1"> </div>
<div>
<p id="webpara">Web app development</p>
</div>
</div>
CSS:
.insidenextcontent2 {
margin-top: 10%;
width: 100%;
height: 15%;
background: #EEFA0F;
display: flex;
}
.bottle1 {
margin-left: 30%;
border-top: 97px solid black;
border-left: 35px solid transparent;
border-right: 35px solid transparent;
height: 0;
width: 150px;
}
#webpara {
color: black;
margin-left: 50%;
font-family: 'Fjalla One', sans-serif;
}

odd padding/margin showing in firefox/chrome

I'm trying to make a list showing horizontally with a 1px border on the right except for the last one. For some reason, on chrome there is a little margin at the bottom but it does not show on Firefox. But on Firefox, there is a margin on the right(last li element) which does not show on chrome. Any ideas on what it could be? I honestly can't find it and I've been trying to fix this for a while now..
body {
font-family: "HelveticaNeue-Light", "Helvetica neue Light", sans-serif;
padding: 0;
margin: 0;
}
#menuBar {
width: 100%;
height: 40px;
background-color: #e0e0e0;
border-bottom: 1px solid grey;
}
#logo {
padding: 5px 0 0 20px;
font-weight: bold;
font-size: 120%;
float: left;
}
#buttonDiv {
float: right;
padding: 5px 10px 0 0;
}
#runButton {
font-size: 120%;
}
#toggles {
width: 256px;
margin: 0 auto;
list-style: none;
padding: 0;
height: 29px;
border: 1px solid grey;
position: relative;
top: 5px;
}
#toggles li {
float: left;
border-right: 1px solid grey;
padding: 5px 7px;
}
li:hover {
background-color: blue;
}
.selected {
background-color: green;
}
<body>
<div id="wrapper">
<div id="menuBar">
<div id="logo">
Website Visualizer
</div>
<div id="buttonDiv">
<button id="runButton">Run Code</button>
</div>
<ul id="toggles">
<li class="toggle selected">HTML</li>
<li class="toggle ">CSS</li>
<li class="toggle ">JavaScript</li>
<li class="toggle selected" style="border:none">Result</li>
</ul>
</div>
</div>
edit: hey guys i fixed it. So basically i removed the border from the UL element and just added a border all around each individual li element.
On your #toggles remove:
#toggles {
/*width: 256px;*/
margin: 0 auto;
list-style: none;
padding: 0;
height: 29px;
border: 1px solid grey;
position: relative;
top: 5px;
}
You need to change your code in #toggles as follows:
#toggles {
/* width: 256px; */
margin: 0 auto;
list-style: none;
padding: 0;
height: 29px;
border: 1px solid grey;
position: relative;
top: 5px;
}
By removing the width on the container, you make sure that the width of the container is equal to the sum of all the widths of its children.
Then change your definition of #toggles lias follows:
#toggles li {
float: left;
border-right: 1px solid grey;
padding: 0 7px;
line-height: 29px;
}
By setting the line-heightto the container height, you make sure the children will occupy the full vertical space while aligning the text vertically (if you don't care about vertical alignment, you can also set height: 100%;)

Div with Text Shifting Other Elements Around

I have a set of images on my webpage. I attached a div before the image that will display some information about the photo. I shifted the div to fit my specifications, but the problem is that the image has also shifted to the right to fit the number of characters in my text. It should also be noted that there is PHP code involved in estimating the width and height of each image. To add or get rid of any tags or classes/ids would mess up the code. I'm at a lost at what to do now.
HTML Part
<div id="tube">
<div class="part_1">
<div class="text">wed dfasdfasd sda asd sa asd </div>
<img class="image_section_1" src="https://encrypted-tbn3.google.com
/images?q=tbn:ANd9GcRGr-DN5J2NpvVMVBcu-MgRFkN3S5CCpZ-H6OGxDLoNwNrYM9k3HQ" />
<div class="text">wed dfasdfasd sda asd sa asd </div>
<img class="image_section_2" src="https://encrypted-tbn3.google.com
/images?q=tbn:ANd9GcRGr-DN5J2NpvVMVBcu-MgRFkN3S5CCpZ-H6OGxDLoNwNrYM9k3HQ" />
</div>
</div>
Here is the CSS
*{border:1px solid grey; padding: 0; margin: 0;}
html { background-color: whitesmoke; height: 100%; width:500%;}
#tube { height: 100%; margin-top: 50px; padding-left: 10px;}
.part_1 {height: 44%; width: 100%; }
#tube img {border-radius:5px; padding: 7px; background-color: white; padding-bottom:
35px; border:1px solid grey; margin: 5px; box-shadow: 1px 1px 3px black;}
.image_section_1 {width: 5.4%; height: 67%;margin-right: 25px;}
.image_section_2 {width: 5.4%; height: 67%;margin-right: 25px;}
.text {display: inline; width: 100px; position: relative; left: 250px; bottom: 25px;
overflow: hidden; }*{border:1px solid grey; padding: 0; margin: 0;}
I also created a jfiddle example. As you can see, I want the images to be aligned next each other as well as having the left image only a few pixels off from the left border. http://jsfiddle.net/7xxxw/4/
Is this what you're looking for?
DEMO
JSFiddle
HTML
<div id="tube">
<div class="part_1">
<div class="image">
<img src="https://encrypted-tbn3.google.com/images?q=tbn:ANd9GcRGr-DN5J2NpvVMVBcu-MgRFkN3S5CCpZ-H6OGxDLoNwNrYM9k3HQ">
<p class="legend">wed dfasdfasd sda asd sa asd</p>
</div>
</div>
</div>
CSS
html { background-color: whitesmoke; height: 100%; width:500%;}
#tube {height: 100%; margin-top: 50px; padding-left: 10px;}
.part_1 {height: 44%; width: 100%; }
.image {
display: inline-block;
margin: 5px;
padding: 7px 7px 35px;
background-color: white;
border: 1px solid grey;
border-radius: 5px;
box-shadow: 1px 1px 3px black;
overflow: auto;
text-align: center;
}
.legend {
padding: 0;
margin: 0;
}
Put both the image and the text inside the same <div> and apply the location to that <div>. Add the text after the image.

how to achieve this css display?

I found this image while searching the web and I tried to implement this display on my own. This is what I have so far:
My HTML code is here:
<ul>
<li>
<span style="display:block;"><a href="">
<span><img src="../creation/images/samps/unnamed4.png" width="48" align="absmiddle"/></span>
<span class="price" >Freeep</span>
<span class="appname">Name of the apps that is so long</span>
<span class="developer">by scamexdotexe</span>
</a>
</span>
</li>
</ul>
This is my CSS style:
<style type="text/css">
li{
list-style: none;
width:200px;
border:1px solid #00CCFF;
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
padding: 0px;
}
li:hover{
border:1px solid red;
}
li a{
margin: 0px;
display: block;
width: 100%;
height: 100%;
white-space:nowrap;
text-overflow:ellipsis;
overflow:hidden;
text-decoration:none;
padding:2px;
}
li a span img{
padding: 5px;
}
.price{
position:absolute;
margin-top:4px;
margin-bottom:4px;
color:#0099FF;
font-size:12px;
}
.appname{
}
.developer{
font-size:12px;
color:#666666;
margin:0;
position:inherit;
display:inline;
white-space:nowrap;
}
</style>
I spent hours on cloning the display on the first image but it seems that I have no luck. Can you point what I am doing wrong here? What I really want to do is align the app name and the price horizontally and also align the app name, rating, total downloads vertically.
For starters, I'd change the border radius to 5px, and add a drop shadow:
li {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-moz-box-shadow: 0px 0px 5px #333;
-webkit-box-shadow: 0px 0px 5px #333;
box-shadow: 0px 0px 5px #333;
}
Do you want to use the same colors as well?
Here's a start for you: http://jsfiddle.net/k8ejp/4/
Notes:
the "avatar" div could of course be an image
absolute positioning can be used instead of floating if you want a more complex layout (or find it easier to work with position)
my example uses a few newer features of CSS (like text-overflow) but they should degrade without changing the layout.
HTML
<div class="box">
<div class="avatar">foo</div>
<div class="price">Free!</div>
<div class="name">A long app name A long app name A long app name A long app name</div>
<div class="info">Other info about the app goes here.</div>
</div>​
CSS
.box{
font: 11px/1.5 sans-serif;
padding: 8px;
background-color: #ccddcc;
width: 400px;
border-radius: 4px;
border: 1px solid silver;
box-shadow: 2px 2px 2px #ddd;
}
.avatar {
width: 32px;
height: 32px;
background-color: #555;
float: left;
margin-right: 12px;
}
.price {
float: right;
color: green;
}
.name {
width: 200px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
I have created an example here: http://jsfiddle.net/D26Hj/1/.
It just needs an app logo and star sprite image.
I have drawn up a star sprite image and quickly made a fake logo in Paint.NET.
Info about the sprite:
Each star is 9px wide.
There are 5 stars in a rating, so therefore each rating is 45px wide.
Therefore, to change the rating change the background-position as per below.
Here are the background-positions to use for different star ratings:
-0px 0 Stars
-45px 1 Star
-90px 2 Stars
-135px 3 Stars
-180px 4 Stars
-225px 5 Stars
I have added classes to make it easier, use rating-0 to rating-5 for 0 stars to 5 stars.
HTML:
<div class="app">
<div class="image"></div>
<div class="title">
App title
</div>
<div class="price">$0.00</div>
<div class="rating rating-3">3 stars</div>
<div class="info">1024 downloads</div>
</div>
CSS:
body {
padding: 20px;
}
.app {
position: relative;
width: 225px;
height: 50px;
padding: 5px;
background: #8f8;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
border: 1px solid #484;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
box-shadow: 0 0 2px #484;
-moz-box-shadow: 0 0 3px #888;
-webkit-box-shadow: 0 0 3px #888;
}
.app a {
text-decoration: none
}
.app .image, .app .title, .app .price, .app .rating, .app .info {
position: absolute;
}
.app .image {
left: 5px;
top: 5px;
width: 48px;
height: 48px;
background-image: url('http://i.imgur.com/JAgto.png');
}
.app .title {
left: 60px;
top: 7px;
}
.app .price {
right: 5px;
top: 7px;
color: #262;
}
.app .rating {
left: 65px;
top: 25px;
width: 45px;
height: 10px;
text-indent: -999px;
background-image: url('http://i.imgur.com/giWyQ.png');
background-position: -135px 0;
}
.app .info {
left: 60px;
top: 40px;
font-size: 11px;
color: #666;
}
.rating-0 {
background-position: 0 0;
}
.rating-1 {
background-position: -45px 0;
}
.rating-2 {
background-position: -90px 0;
}
.rating-3 {
background-position: -135px 0;
}
.rating-4 {
background-position: -180px 0;
}
.rating-5 {
background-position: -225px 0;
}
I'm not so sure you should use span, personally I would use div instead since it's default display style is already block, which I see is what you try to achieve on the description block.
And about the Price and AppName, I would suggest that you wrap them inside a Div container on the same level with rating and downloads count and make that container display style inline-block then adjust the width for both Price and AppName.
It would be like this
<div class="main-container">
<div class="image"> Image Goes Here </div>
<div class="description">
<div class="description-top">
<div class"description-top-title"> Title Goes Here</div>
<div class"description-top-price"> Price Goes Here</div>
</div>
<div class="description-middle"> Rating Goes Here</div>
<div class="description-bottom"> Download Count Goes Here</div>
</div>
</div>
.main-container{
display: inline-block;
}
.image{
width: 30%;
}
.description{
display: block;
width: 70%;
}
.description-top{
display: inline-block;
}
.description-top-title{
width: 60%;
}
.description-top-price{
width: 40%;
}