div's with text over image slider - css

I was wondering; how can i display div's over an image slider. Right now the div falls behind the slider. Z-index is not helping and i also tried a position: absolute but that messes up even more. Here is my example: http://gelijkanders.com/nieuw/template-devotion/
HTML:
<div id="header">
<img src="assets/images/header1.png" />
<img src="assets/images/header2.png" />
</div>
<div class="wrapper">
<div class="container">
<div id="headlight-left">
<img src="assets/images/casablanca.png"/>
<h1>Casa Blanca</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed id urna pretium, venenatis tellus nec, scelerisque nisi. Vestibulum sapien risus, adipiscing vel interdum non, euismod in nisi. Nullam in ultrices est, vel sodales nisl. Donec sodales aliquam diam, eu hendrerit felis fringilla eget. lobortis. </p>
<a class="button" href="#">Lees meer</a>
</div>
<div id="headlight-center">
<img src="assets/images/sealicious.png"/>
<h1>Casa Blanca</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed id urna pretium, venenatis tellus nec, scelerisque nisi. Vestibulum sapien risus, adipiscing vel interdum non, euismod in nisi. Nullam in ultrices est, vel sodales nisl. Donec sodales aliquam diam, eu hendrerit felis fringilla eget. lobortis. </p>
<a class="button" href="#">Lees meer</a>
</div>
<div id="headlight-right">
<img src="assets/images/cielo.png"/>
<h1>Casa Blanca</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed id urna pretium, venenatis tellus nec, scelerisque nisi. Vestibulum sapien risus, adipiscing vel interdum non, euismod in nisi. Nullam in ultrices est, vel sodales nisl. Donec sodales aliquam diam, eu hendrerit felis fringilla eget. lobortis. </p>
<a class="button" href="#">Lees meer</a>
</div>
<div id="content">
<h1>We are W Travel</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed id urna pretium, venenatis tellus nec, scelerisque nisi. Vestibulum sapien risus, adipiscing vel interdum non, euismod in nisi. Nullam in ultrices est, vel sodales nisl. Donec sodales aliquam diam, eu hendrerit felis fringilla eget. lobortis.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed id urna pretium, venenatis tellus nec, scelerisque nisi. Vestibulum sapien risus, adipiscing vel interdum non, euismod in nisi. Nullam in ultrices est, vel sodales nisl. Donec sodales aliquam diam, eu hendrerit felis fringilla eget. lobortis.</p>
</div>
and the css:
#header {
height:464px;
width:1920px;
position:relative;
overflow:hidden;
z-index:-99;
}
#headlight-left {
background:url(images/headlights-bg.png);
background-repeat:repeat-y;
width:289px;
height:464px;
float:left;
padding:15px;
position:relative;
margin-top:-138px;
z-index:99999;
}
#content {
width:648px;
padding:20px;
position:relative;
top:20px;
float:left;
display:block;
}
I hope this makes any sense and you are able the to see my problem because i know it's somehow possible. Anyway thanks in advance!!

I don't know if I understand, but if the problem is that the slider is over the container, the solution is simple, remove overflow:hidden; to .container{}

Is this what you are looking for
http://jsfiddle.net/cancerian73/zdBRk/
.container {
width:1024px;
margin:0 auto;
position:relative;
/*overflow:hidden;*/
padding:20px;
}
Do you want it to overlap or start after the jquery cycle banner?

Related

Div under another div that fills the space in the parent

Putting it simple.
Here is what I done:
https://codepen.io/matt1991/pen/abdeZNv
I've tried using flexbox to a extent, tried to mess with a lot of classes and properties, and yet can't do what I need, that is:
I need the div right-down to fill the space under the div right-up until both of them, together, have the same height of left, using only css, on a system built up on materialize.css. I know how to do that with javascript involved, but I want to make it using only css, in a way that, if left or right-up get more or less text, the size stays the same.
ps.: The red div MUST stop at the green one, it cannot go until the top and z-indexed behind the green one.
Any ideas?
If it's okay to remove the materialize.css it's easy:
<div id="main" class="container">
<div class="flex">
<div id="left">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris a aliquam urna, non imperdiet turpis. Nullam id mauris vel neque eleifend sollicitudin sit amet nec justo. Mauris auctor, erat nec bibendum posuere, nibh justo elementum orci, ut convallis tellus risus a orci. Integer sodales viverra erat, quis tincidunt ante ornare sit amet. Donec sed urna urna. Cras in lectus in erat iaculis euismod. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam rutrum in lorem eget tristique. Nam at ex commodo, vestibulum nulla quis, convallis dolor. Etiam posuere augue massa. In pulvinar vitae dolor vel feugiat.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris a aliquam urna, non imperdiet turpis. Nullam id mauris vel neque eleifend sollicitudin sit amet nec justo. Mauris auctor, erat nec bibendum posuere, nibh justo elementum orci, ut convallis tellus risus a orci. Integer sodales viverra erat, quis tincidunt ante ornare sit amet. Donec sed urna urna. Cras in lectus in erat iaculis euismod. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam rutrum in lorem eget tristique. Nam at ex commodo, vestibulum nulla quis, convallis dolor. Etiam posuere augue massa. In pulvinar vitae dolor vel feugiat.
</div>
<div id="right">
<div id="right-up">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris a aliquam urna, non imperdiet turpis. Nullam id mauris vel neque eleifend sollicitudin sit amet nec justo. Mauris auctor, erat nec bibendum posuere, nibh justo elementum orci, ut convallis tellus risus a orci.
</div>
<div id="right-down"></div>
</div>
</div>
</div>
body {
height: 100%
}
#main {
display: flex;
flex-flow: column;
height: 100%
}
.flex {
display: flex;
}
#left {
background-color: blue;
flex: 2;
}
#right {
display: flex;
flex-direction: column;
flex: 1;
}
#right-up {
background-color: green;
}
#right-down {
background-color: red;
flex: 1;
}

Bootstrap image auto resize doesn't works in left column

I have standard 3 column layout with similar img in left and right column. When I resize page, right image becomes smaller but left not. And middle container overflow left image.
Css for image resizing:
img {
display: block;
max-width: 100%;
height: auto;
}
My full code is:
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Title</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
.logo_item {
display: inline-block;
margin-left: 2.5em;
margin-right: 2.5em;
}
img {
display: block;
max-width: 100%;
height: auto;
}
</style>
</head>
<body>
<div class="container-fluid">
<!-- 2nd row -->
<div class="row mt-4">
<div class="brd_black col">
<div style="position:fixed;">
<img src="https://v1.iconsearch.ru/uploads/icons/crystalclear/64x64/folder_home.png" /></div>
</div>
<div class="brd_black col-10">
<div class="row">
<div class="brd_black col-12 bg-white align-top brd_grey pb-3 pt-3 text-center">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras id lacus sit amet leo feugiat venenatis. Donec mattis erat eget velit dapibus, at consequat nisi pretium. Nulla ut elementum ex, in rutrum neque. Integer eu blandit sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae pulvinar odio. Morbi fermentum dolor sapien, vitae semper est maximus non. Vestibulum bibendum aliquet lacinia. Nullam sollicitudin auctor metus vel pretium. Donec fermentum ligula suscipit metus varius dictum. Curabitur ultrices justo at arcu cursus, sit amet iaculis dolor dapibus. Morbi semper porta nunc. Aliquam rutrum congue nunc non facilisis.
</div>
</div>
</div>
<div class="brd_black col">
<div style="position:fixed;">
<img src="https://v1.iconsearch.ru/uploads/icons/crystalclear/64x64/folder_home.png" target="_blank" /></div>
</div>
</div>
</div>
</div>
</body>
</html>
But why?
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Title</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
.logo_item {
display: inline-block;
margin-left: 2.5em;
margin-right: 2.5em;
}
img {
display: block;
max-width: 100%;
height: auto;
}
.bg_img
{
background: url('https://v1.iconsearch.ru/uploads/icons/crystalclear/64x64/folder_home.png')no-repeat center center;
display: block;
width: 20px;
height: 20px;
background-size: contain;
float: left;
position: fixed;
}
</style>
</head>
<body>
<div class="container-fluid">
<!-- 2nd row -->
<div class="row mt-4">
<div class="brd_black col">
<div>
</div>
</div>
<div class="brd_black col-10">
<div class="row">
<div class="brd_black col-12 bg-white align-top brd_grey pb-3 pt-3 text-center">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras id lacus sit amet leo feugiat venenatis. Donec mattis erat eget velit dapibus, at consequat nisi pretium. Nulla ut elementum ex, in rutrum neque. Integer eu blandit sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae pulvinar odio. Morbi fermentum dolor sapien, vitae semper est maximus non. Vestibulum bibendum aliquet lacinia. Nullam sollicitudin auctor metus vel pretium. Donec fermentum ligula suscipit metus varius dictum. Curabitur ultrices justo at arcu cursus, sit amet iaculis dolor dapibus. Morbi semper porta nunc. Aliquam rutrum congue nunc non facilisis.
</div>
</div>
</div>
<div class="brd_black col">
<div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Remove position:fixed style from the div.
I have tried your code and removed your img tag styles and replaced it with the default img-fluid class of bootstrap-4 and it's working fantastic.
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Title</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
.logo_item {
display: inline-block;
margin-left: 2.5em;
margin-right: 2.5em;
}
.sticky {
position: sticky;
position: -webkit-sticky !important;
top: 0;
right: 0;
left: 0;
z-index: 1030;
display: flex;
}
.stick_img{
position: sticky;
position: -webkit-sticky !important;
top: 15px;
}
</style>
</head>
<body>
<div class="container-fluid">
<!-- 2nd row -->
<div class="row mt-4">
<div class="brd_black col sticky">
<div>
<img src="https://v1.iconsearch.ru/uploads/icons/crystalclear/64x64/folder_home.png" class="img-fluid stick_img" /></div>
</div>
<div class="brd_black col-10">
<div class="row">
<div class="brd_black col-12 bg-white align-top brd_grey pb-3 pt-3 text-center">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras id lacus sit amet leo feugiat venenatis. Donec mattis erat eget velit dapibus, at consequat nisi pretium. Nulla ut elementum ex, in rutrum neque. Integer eu blandit sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae pulvinar odio. Morbi fermentum dolor sapien, vitae semper est maximus non. Vestibulum bibendum aliquet lacinia. Nullam sollicitudin auctor metus vel pretium. Donec fermentum ligula suscipit metus varius dictum. Curabitur ultrices justo at arcu cursus, sit amet iaculis dolor dapibus. Morbi semper porta nunc. Aliquam rutrum congue nunc non facilisis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras id lacus sit amet leo feugiat venenatis. Donec mattis erat eget velit dapibus, at consequat nisi pretium. Nulla ut elementum ex, in rutrum neque. Integer eu blandit sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae pulvinar odio. Morbi fermentum dolor sapien, vitae semper est maximus non. Vestibulum bibendum aliquet lacinia. Nullam sollicitudin auctor metus vel pretium. Donec fermentum ligula suscipit metus varius dictum. Curabitur ultrices justo at arcu cursus, sit amet iaculis dolor dapibus. Morbi semper porta nunc. Aliquam rutrum congue nunc non facilisis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras id lacus sit amet leo feugiat venenatis. Donec mattis erat eget velit dapibus, at consequat nisi pretium. Nulla ut elementum ex, in rutrum neque. Integer eu blandit sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae pulvinar odio. Morbi fermentum dolor sapien, vitae semper est maximus non. Vestibulum bibendum aliquet lacinia. Nullam sollicitudin auctor metus vel pretium. Donec fermentum ligula suscipit metus varius dictum. Curabitur ultrices justo at arcu cursus, sit amet iaculis dolor dapibus. Morbi semper porta nunc. Aliquam rutrum congue nunc non facilisis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras id lacus sit amet leo feugiat venenatis. Donec mattis erat eget velit dapibus, at consequat nisi pretium. Nulla ut elementum ex, in rutrum neque. Integer eu blandit sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae pulvinar odio. Morbi fermentum dolor sapien, vitae semper est maximus non. Vestibulum bibendum aliquet lacinia. Nullam sollicitudin auctor metus vel pretium. Donec fermentum ligula suscipit metus varius dictum. Curabitur ultrices justo at arcu cursus, sit amet iaculis dolor dapibus. Morbi semper porta nunc. Aliquam rutrum congue nunc non facilisis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras id lacus sit amet leo feugiat venenatis. Donec mattis erat eget velit dapibus, at consequat nisi pretium. Nulla ut elementum ex, in rutrum neque. Integer eu blandit sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae pulvinar odio. Morbi fermentum dolor sapien, vitae semper est maximus non. Vestibulum bibendum aliquet lacinia. Nullam sollicitudin auctor metus vel pretium. Donec fermentum ligula suscipit metus varius dictum. Curabitur ultrices justo at arcu cursus, sit amet iaculis dolor dapibus. Morbi semper porta nunc. Aliquam rutrum congue nunc non facilisis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras id lacus sit amet leo feugiat venenatis. Donec mattis erat eget velit dapibus, at consequat nisi pretium. Nulla ut elementum ex, in rutrum neque. Integer eu blandit sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae pulvinar odio. Morbi fermentum dolor sapien, vitae semper est maximus non. Vestibulum bibendum aliquet lacinia. Nullam sollicitudin auctor metus vel pretium. Donec fermentum ligula suscipit metus varius dictum. Curabitur ultrices justo at arcu cursus, sit amet iaculis dolor dapibus. Morbi semper porta nunc. Aliquam rutrum congue nunc non facilisis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras id lacus sit amet leo feugiat venenatis. Donec mattis erat eget velit dapibus, at consequat nisi pretium. Nulla ut elementum ex, in rutrum neque. Integer eu blandit sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae pulvinar odio. Morbi fermentum dolor sapien, vitae semper est maximus non. Vestibulum bibendum aliquet lacinia. Nullam sollicitudin auctor metus vel pretium. Donec fermentum ligula suscipit metus varius dictum. Curabitur ultrices justo at arcu cursus, sit amet iaculis dolor dapibus. Morbi semper porta nunc. Aliquam rutrum congue nunc non facilisis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras id lacus sit amet leo feugiat venenatis. Donec mattis erat eget velit dapibus, at consequat nisi pretium. Nulla ut elementum ex, in rutrum neque. Integer eu blandit sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae pulvinar odio. Morbi fermentum dolor sapien, vitae semper est maximus non. Vestibulum bibendum aliquet lacinia. Nullam sollicitudin auctor metus vel pretium. Donec fermentum ligula suscipit metus varius dictum. Curabitur ultrices justo at arcu cursus, sit amet iaculis dolor dapibus. Morbi semper porta nunc. Aliquam rutrum congue nunc non facilisis.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras id lacus sit amet leo feugiat venenatis. Donec mattis erat eget velit dapibus, at consequat nisi pretium. Nulla ut elementum ex, in rutrum neque. Integer eu blandit sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vitae pulvinar odio. Morbi fermentum dolor sapien, vitae semper est maximus non. Vestibulum bibendum aliquet lacinia. Nullam sollicitudin auctor metus vel pretium. Donec fermentum ligula suscipit metus varius dictum. Curabitur ultrices justo at arcu cursus, sit amet iaculis dolor dapibus. Morbi semper porta nunc. Aliquam rutrum congue nunc non facilisis.
</div>
</div>
</div>
<div class="brd_black col sticky">
<div>
<img src="https://v1.iconsearch.ru/uploads/icons/crystalclear/64x64/folder_home.png" target="_blank" class="img-fluid stick_img" /></div>
</div>
</div>
</div>
</div>
</body>
</html>
Try this whole code, Hopefully it'll work
remove position:fixed; style for your code.

Css elements with the same auto height

I would like to have a design based on the following HTML code:
<div class="container">
<div class='image'><img src="http://lorempixel.com/500/500" width="500" height="500" /></div>
<div class='title'>Title</div>
<div class='content'>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam congue, tortor in mattis mattis, arcu erat pharetra orci, at vestibulum lorem ante a felis. Integer sit amet est ac elit vulputate lobortis. Vestibulum in ipsum nulla. Aenean erat elit, lacinia sit amet adipiscing quis, aliquet at erat. Vivamus massa sem, cursus vel semper non, dictum vitae mi. Donec sed bibendum ante.</div>
</div>
<div class="container">
<div class='image'><img src="http://lorempixel.com/500/500" width="500" height="500" /></div>
<div class='title'>This is a very very long title longer than a single line, maybe two or three lines... I don't know!</div>
<div class='content'>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam congue, tortor in mattis mattis, arcu erat pharetra orci, at vestibulum lorem ante a felis. Integer sit amet est ac elit vulputate lobortis. Vestibulum in ipsum nulla. Aenean erat elit, lacinia sit amet adipiscing quis, aliquet at erat. Vivamus massa sem, cursus vel semper non, dictum vitae mi. Donec sed bibendum ante.</div>
</div>
What I am searching to do is to have two columns (the "container" divs) and to have the "title" elements all of the same height. I do not want to have a fixed height (because I do not know how long it is the title), and I'd like not to use Javascript.
Is there any css trick or css selector that is like "all .title elements have the same auto height"?
Thank you.
Could you try the style below and let me know if that is what you are looking for?:
<style>
.container {
display: inline-block;
width: 200px; /* change as you see fit */
/*height: 100px; change as you see fit */
margin: 10px; /* change as you see fit */
}
.image>img{
width:50px !important; /* change as you see fit */
height:50px !important; /* change as you see fit */
}
div.title{
min-height:40px !important; /* change as you see fit */
margin:10px 0 !important; /* change as you see fit */
background:#EEE !important; /* change as you see fit */
padding: 10px !important; /* change as you see fit */
}
</style>
<div class="container">
<div class='image'><img src="http://lorempixel.com/500/500"/></div>
<div class='title'>Title</div>
<div class='content'>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam congue, tortor in mattis mattis, arcu erat pharetra orci, at vestibulum lorem ante a felis. Integer sit amet est ac elit vulputate lobortis. Vestibulum in ipsum nulla. Aenean erat elit, lacinia sit amet adipiscing quis, aliquet at erat. Vivamus massa sem, cursus vel semper non, dictum vitae mi. Donec sed bibendum ante.</div>
</div>
<div class="container">
<div class='image'><img src="http://lorempixel.com/500/500" width="500" height="500" /></div>
<div class='title'>This is a very very long title longer than a single line, maybe two or three lines... I don't know!</div>
<div class='content'>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam congue, tortor in mattis mattis, arcu erat pharetra orci, at vestibulum lorem ante a felis. Integer sit amet est ac elit vulputate lobortis. Vestibulum in ipsum nulla. Aenean erat elit, lacinia sit amet adipiscing quis, aliquet at erat. Vivamus massa sem, cursus vel semper non, dictum vitae mi. Donec sed bibendum ante.</div>
</div>
Hope it helps.

CSS on first letter of <p> only not <blockquote><p>

Please help me out here, I've created this jsfiddle to make it clear.
http://jsfiddle.net/yvesvanlaer/2r3Cp/
The first letter is also different in a deeper level
I only want it to be on the first P (not in the blockquote).
Thank you so much.
<div about="/news/lorem-ipsum-dolor-sit-amet-consectetur-adipiscing-elit" typeof="sioc:Item foaf:Document" class="ds-1col node node-news view-mode-full clearfix">
<div class="field field-name-title field-type-ds field-label-hidden">
<div class="field-items">
<div class="field-item even" property="dc:title">
<h1>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</h1>
</div>
</div>
</div>
<div class="field field-name-body field-type-text-with-summary field-label-hidden">
<div class="field-items">
<div class="field-item even" property="content:encoded">
<p>
Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Aenean lacinia bibendum nulla sed consectetur.
</p>
<blockquote>
<p>
Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Vestibulum id ligula porta felis euismod semper. Nullam quis risus eget urna mollis ornare vel eu leo. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
</p>
</blockquote>
</div>
</div>
</div>
</div>
You need only the immediate descendant of .field-item, so add that in there with >:
.view-mode-full .field-name-body .field-item > p:first-child:first-letter {
float: left;
font-size: 36px;
line-height: 36px;
padding-right: 4px;
font-style: normal;
}
JSFiddle

Hiding the last item in case of overflow via CSS

I have a .list of .items, like this one:
<div class="list">
<div class="item">...</div>
<div class="item">...</div>
<div class="item">...</div>
</div>
Both .item and .list have a maximal height, say 100px and 280px.
I'd like to hide the last .item when it overflows, possibly with no JS.
What I mean is that if .list has overflow: hidden, and all .items reach the max height, then the last one is partially cut. I'd like to hide it completely, i.e. either it fits, or it disappears.
I can change both the CSS and the HTML (including, e.g., using <ul><li>... instead of divs)
If your items would've had a fixed height, and not a maximum, you could've used nth-child to predict at which item it will start to overflow.
Sample | Code
.item{
height: 75px;
border: 1px solid blue;
overflow: auto;
}
.item:nth-child(1n+4){ /* 4th element and up */
display: none;
}
.list{
max-height: 280px;
border: 1px solid red;
overflow: hidden;
}
However, since they aren't fixed heights, the only solution for such dynamics is using javascript.
On that note, here's a javascript solution.
Sample | Code
Javascript
var eList = document.getElementById("list"),
eItems = eList.getElementsByTagName("div"),
iMaxHeight = parseInt(getStyle(eList, "max-height")),
iSumHeight = 0;
for(i = 0; i < eItems.length; i++){
var iHeight = parseInt(getStyle(eItems[i], "height"));
//Check if next item will overflow, in which case, we're going to hide it
if((iSumHeight + iHeight) >= iMaxHeight){
eItems[i].style.display = "none";
}else{
iSumHeight += iHeight;
}
}
function getStyle(el,styleProp){
if (el.currentStyle)
var y = el.currentStyle[styleProp];
else if (window.getComputedStyle)
var y = document.defaultView.getComputedStyle(el,null).getPropertyValue(styleProp);
return y;
}
HTML
<div id="list">
<div class="item">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc pulvinar aliquet risus, vitae suscipit tortor cursus ac.</div>
<div class="item">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc pulvinar aliquet risus, vitae suscipit tortor cursus ac. Nam venenatis, nunc sit amet elementum semper, sem purus ultrices diam, quis scelerisque elit nulla sed sapien. Vivamus urna metus, tincidunt ac accumsan et, dignissim at lorem.</div>
<div class="item">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc pulvinar aliquet risus, vitae suscipit tortor cursus ac. Nam venenatis, nunc sit amet elementum semper, sem purus ultrices diam, quis scelerisque elit nulla sed sapien. Vivamus urna metus, tincidunt ac accumsan et, dignissim at lorem.</div>
<div class="item">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc pulvinar aliquet risus, vitae suscipit tortor cursus ac. Nam venenatis, nunc sit amet elementum semper, sem purus ultrices diam, quis scelerisque elit nulla sed sapien. Vivamus urna metus, tincidunt ac accumsan et, dignissim at lorem.</div>
<div class="item">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc pulvinar aliquet risus, vitae suscipit tortor cursus ac. Nam venenatis, nunc sit amet elementum semper, sem purus ultrices diam, quis scelerisque elit nulla sed sapien. Vivamus urna metus, tincidunt ac accumsan et, dignissim at lorem.</div>
<div class="item">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc pulvinar aliquet risus, vitae suscipit tortor cursus ac. Nam venenatis, nunc sit amet elementum semper, sem purus ultrices diam, quis scelerisque elit nulla sed sapien. Vivamus urna metus, tincidunt ac accumsan et, dignissim at lorem.</div>
<div class="item">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc pulvinar aliquet risus, vitae suscipit tortor cursus ac. Nam venenatis, nunc sit amet elementum semper, sem purus ultrices diam, quis scelerisque elit nulla sed sapien. Vivamus urna metus, tincidunt ac accumsan et, dignissim at lorem.</div>
<div class="item">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc pulvinar aliquet risus, vitae suscipit tortor cursus ac.</div>
</div>
CSS
.item{
max-height: 110px;
border: 1px solid blue;
overflow: auto;
}
#list{
max-height: 290px;
border: 1px solid red;
overflow: hidden;
}
You need javascript to compute height of items, or if you want to do it just with css and you know that heights of both elements will not change, you can compute how many will fit and hide others using nth-child css selector nth-child

Resources