I want to put one image left, one image right and text in the middle.
I keep thinking I am close then one or another runs away! I would appreciate some help and guidance.
Code for page and CSS below
VB page
<div id="HeaderTitleWrapper">
<h2><img src="images/Header/logo.jpg" alt="Writting Icon" />
<div id="HeaderTel">
GATEWAY<img src="images/Header/pic2.jpg" alt="Writing Icon" />
</div> <!-- HeaderTel -->
</h2>
</div> <!-- HeaderTitleWrapper -->
CSS
/* Header Text Title */
#HeaderTitleWrapper {
width: 1000px ;
margin-left: auto ;
margin-right: auto ;
}
#HeaderTitleContent {
padding: 0px;
height: auto;
position: relative;
left: 0px;
top:10px;
}
#HeaderTel
{
position:absolute;
right:150px;
top:auto;
}
Using text-align:justify and pseudo , you can spray inline-boxes from left to right.
<header>
<img/>
<span>text</span>
<img/
<header>
header {
line-height:0;
text-align:justify;
}
header span {
display:inline-block;
vertical-align:middle;
line-height:1.2em;
}
header:after {
content:'';
display:inline-block;
width:99%;
vertical-align:top;
}
similar exemple : http://codepen.io/gcyrillus/pen/dlvCp
<div
id="firstImage">
<img
src="1.jpg"
alt="Writting Icon"
/>
</div>
<span
id="Text">
GATEWAY
</span>
<div
id="secondImage">
<img
src="2.jpg"
alt="Writing Icon"
/>
</div>
<!-- HeaderTel -->
</div>
Related
The following code (jsfiddle) implements an image viewer in CSS
<!DOCTYPE html>
<head>
<title>Trains, Planes, Automobiles, and Boats</title>
<meta charset="UTF-8">
<style type="text/css" media="screen">
html, body { background:#ddd; margin:0; padding:0; height:100%; }
#foo { position:absolute; left:5%; width:60%; top:5%; height:80%; background:#dcc; }
#bar { position:absolute; left:70%; width:25%; top:5%; height:80%; background:#cbd; vertical-align: middle; }
.fullwidth { width: 100%; vertical-align: middle; }
.vcenter {
display: block;
margin: 0 auto;
}
</style>
</head>
<body>
<div id="foo">
<div class="vcenter">
<img class="fullwidth" src="https://openclipart.org/image/800px/svg_to_png/19623/philrich123-A380.png" />
</div>
</div>
<div id="bar">
<img class="fullwidth" src="https://openclipart.org/image/800px/svg_to_png/4703/ryanlerch-Steam-Train-Engine.png" />
<img class="fullwidth" src="https://openclipart.org/image/800px/svg_to_png/19623/philrich123-A380.png" />
<img class="fullwidth" src="http://openclipart.org/image/800px/svg_to_png/74557/rally-car.png" />
<img class="fullwidth" src="https://openclipart.org/image/800px/svg_to_png/196201/Model-T-Ford.png&disposition=attachment" />
<img class="fullwidth" src="https://openclipart.org/image/800px/svg_to_png/24418/Jarno-Boat-1.png&disposition=attachment" />
</div>
</body>
How do I fix the following two bugs?
The bar side does not scroll.
The image in the foo side is not centered. The intention is to make all the image visible in the left side while filling its container in one dimension (vertical/horizontal) and being scaled in the other (horizontal/vertical) to remain at 1:1 ratio.
I'm not sure I understood your question, but if you only want to make your right div scrollable then add this to your css
#bar{
overflow: scroll;
}
Example
To answer your second question (vertically centering the left image), add these rules to your vcenter class
position: relative;
top: 50%;
transform: translateY(-50%);
Example 2
I have a section in my site that should stretch all the way across the screen.
I want to add 4 images in this section, one beside the other, and make them responsive. I want them to fill the background and breaks between them as needed. How should I modify my code below to accomplish the effects I desire?
#games {
background-color: #000;
}
#games img {
width: 100%;
height: auto;
}
.4columns {
width: 32%;
display: inline-block;
}
<section id="games" class="section section-games">
<div class="container-fluid">
<div class="row">
<img class="4columns" src="resources/media/icons/1.png">
<img class="4columns" src="resources/media/icons/2.png">
<img class="4columns" src="resources/media/icons/3.png">
<img class="4columns" src="resources/media/icons/4.png">
</div>
</div>
</section>
I think you want something like this :
.map{
margin:0;
padding:0;
}
.map img{
float: left;
width: 25%;
}
<div class="map">
<span>
<img src="http://www.inkntoneruk.co.uk/ink-cartridge-news/wp-content/uploads/2016/01/LOTRFOTRmovie.jpg" />
<img src="http://www.inkntoneruk.co.uk/ink-cartridge-news/wp-content/uploads/2016/01/LOTRFOTRmovie.jpg" />
<img src="http://www.inkntoneruk.co.uk/ink-cartridge-news/wp-content/uploads/2016/01/LOTRFOTRmovie.jpg" />
<img src="http://www.inkntoneruk.co.uk/ink-cartridge-news/wp-content/uploads/2016/01/LOTRFOTRmovie.jpg" />
</span>
</div>
I'm working with 100% width relative positioning, but need an absolute positioned child div or span to hold a jquery image slider.
Layout
------ width 100%-------
| img1 | slider | img2 |
Currently the slider span isn't being positioned inline like the other objects and overlapping
What I have so far:
Fiddle
HTML
<div class="pic_container">
<img src="http://www.image-and-text.com/pictures/whiskey_with_ice.jpg">
<span class="viewer">
<img src="http://images.printsplace.co.uk/Content/Images/Products/46576/43569/Image_of_M101_1.jpg" alt="" class="active" />
<img src="http://i.bosity.com/clothes_cache/261/12002348/3480000011312473207_12002348_1_image.jpg" alt="" />
<img src="http://lokeshdhakar.com/projects/lightbox2/images/examples/image-6.jpg" alt="" />
</span>
<img src="http://www.image-and-text.com/pictures/whiskey_with_ice.jpg">
</div>
</div>
CSS
/*slideshow*/
.viewer {
font-size:0;
display:inline;
}
.viewer IMG {
position:absolute;
z-index:8;
width:50%;
vertical-align:top;
}
.viewer IMG.active {
z-index:10;
}
.viewer IMG.last-active {
z-index:9;
}
/*pics*/
.pic_container{
font-size:0;
display:inline;
}
.pic_container img {
width:25%;
vertical-align:top;
}
I've added a wrapper to the viewer and removed the extra spacing between your outer images and the slideshow viewer using the html comment tags (this is better than setting font-size:0). I've adjusted the JS, so that the transition works. I've also cleaned up and reduced the amount of CSS needed.
HTML
<div class="picture-container">
<img src="http://www.image-and-text.com/pictures/whiskey_with_ice.jpg" /><!--
--><div class="viewer">
<img src="http://images.printsplace.co.uk/Content/Images/Products/46576/43569/Image_of_M101_1.jpg" class="active" />
<img src="http://i.bosity.com/clothes_cache/261/12002348/3480000011312473207_12002348_1_image.jpg" />
<img src="http://lokeshdhakar.com/projects/lightbox2/images/examples/image-6.jpg" />
</div><!--
--><img src="http://www.image-and-text.com/pictures/whiskey_with_ice.jpg" />
</div>
CSS:
* {margin:0;padding:0}
.picture-container > img {display:inline-block;width:25%;}
.viewer {display:inline-block;position:relative;width:50%;vertical-align:top;}
.viewer img {position:absolute;width:100%;}
JS
function slideSwitch() {
var transitionDuration = 1000;
var active = $('.viewer img.active');
var next = $('.viewer img:first').insertAfter(active);
active.removeClass('active').fadeOut(transitionDuration);
next.addClass('active').hide().fadeIn(transitionDuration);
}
$(document).ready(function(){
$('.viewer img.active').insertAfter('.viewer img:last');
setInterval("slideSwitch()", 4000);
});
You can see it here: http://jsfiddle.net/Ry7Su/1/
Hope this helps.
The following changes will solve your problem.
This is based on your code. You can tweak it to make it shorter.
HTML part:
<div class="pic_container">
<div class="leftDiv">
<img src="http://www.image-and-text.com/pictures/whiskey_with_ice.jpg">
</div><!--
--><div class="viewerWrapper"><div class="viewer">
<img src="http://images.printsplace.co.uk/Content/Images/Products/46576/43569/Image_of_M101_1.jpg" alt="" class="active" />
<img src="http://i.bosity.com/clothes_cache/261/12002348/3480000011312473207_12002348_1_image.jpg" alt="" />
<img src="http://lokeshdhakar.com/projects/lightbox2/images/examples/image-6.jpg" alt="" />
</div></div><!--
--><div class="rightDiv">
<img src="http://www.image-and-text.com/pictures/whiskey_with_ice.jpg">
</div>
</div>
CSS Part:
.pic_container {
display: block;
width: 100%;
position:relative;
}
.leftDiv {
display:inline-block;
width: 25%;
position:relative;
}
.rightDiv {
display:inline-block;
width: 25%;
position:relative;
}
.viewerWrapper {
display:inline-block;
width: 50%;
position:relative;
vertical-align: top;
}
.viewer {
width:100%;
}
.leftDiv IMG, .rightDiv IMG, .viewer IMG {
max-width: 100%;
}
.viewer IMG {
z-index:8;
position: absolute;
}
.viewer IMG.active {
z-index:10;
}
.viewer IMG.last-active {
z-index:9;
}
See it here: http://jsfiddle.net/FTEan/
try to give pic_container position: relative; and try to give viewer display: inline-block; this might work. pic_container could may also be display: inline-block;
I am writing my own template for joomla 2.5.6. I am not sure if this issue is Joomla or simply css related.
The template is simple, it has a sidebar on the left and content on the right, and a footer. Now when the content is short and there are several modules on the sidebar, the modules overlap the footer.
It looks like this:
http://imageshack.us/photo/my-images/269/screenshotmdph.jpg/
The html from index.php looks like this:
<body>
<div class="container_6">
<div class="grid_6 header">
<img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/assets/images/logo.png" alt="home" id="logo"/>
<jdoc:include type="modules" name="menu" />
</div>
</div>
<div class="container_6">
<div class="grid_6 head_logo">
<jdoc:include type="modules" name="header_logo" />
<div class="left_menu">
<div class="left_menu_content">
<jdoc:include type="modules" name="left_menu" style="xhtml" />
</div>
</div>
<div class="right_module">
<jdoc:include type="modules" name="right" />
</div>
</div>
</div>
<div class="container_6">
<div class="grid_6">
<div class="content">
<div class="content_holder">
<!-- beginn content -->
<div class="container_6">
<div class="content_component">
<jdoc:include type="modules" name="breadcrumb" />
<jdoc:include type="component" />
</div>
</div>
</div>
</div>
</div>
</div>
<div class="clear"></div>
<div class="container_6">
<div class="grid_6">
<div class="footer">
</div>
</div>
</div>
I have used the 960-grid system which has the class clear on it, but the other classes are defined here:
.header {
background: url('../images/top.png') no-repeat;
height:93px;
width:100%;
}
.head_logo {
background: url('../images/shadow.png') repeat-y;
padding-right:10px;
padding-left:12px;
z-index:1;
position:absolute;
}
.left_menu {
background: url('../images/menuBg.png') no-repeat;
width:284px;
min-height:611px;
top:300px;
z-index:2;
position:absolute;
}
.right_module {
width:180px;
height:40px;
padding:10px;
background-color:#e9e9e9;
top:300px;
left:730px;
z-index:3;
position:absolute;
}
.content {
background: url('../images/shadow.png') repeat-y;
min-height:500px;
}
.content_holder {
background-color:#e9e9e9;
width:960px;
margin-left: auto;
margin-right: auto;
min-height:500px;
}
.content_component {
width:666px;
padding:5px 5px 5px 284px;
margin:0 5px;
}
#logo {
margin:15px 0 0 25px;
float:left;
}
.footer{
background: url('../images/bottom.png') no-repeat;
width:100%;
height:92px;
}
I am lost with this, because it should work because of the clearing class above the footer, but it doesn't.. Unfortunatedly I have no online example, its all local
Anybody an idea how I could find the error? Thank you so much
ADDITIONAL INFORMATION:
Sorry, I forgot, the
<div class="clear"></div>
Is defined in the grid.css, and looks like this:
.clear {
clear: both;
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0;
}
I edited the question title also, sorry was wrong
Addition!!
I wanted to add a screenshot of the problem. Please look here:
http://www.bilder-hochladen.net/files/jegt-i-6f49-jpg.html
You see, the .left-menu is positioned with absolute and begins inside the .head-logo class. The .left-menu should not go inside the purple footer.
How can I tell the content divs to be equal in height with the left-menu?
Use Clear:both instead of clear:all which is not a style definition in MHO.
From what it seems, you may be placing the 'clear' div in a wrong place, but it's hard to say, not seeing the actual page with all the css attached, including the grid ones. Maybe you would be able to actually generate the page, save to your local disk and put it online?
i am i am new in CSS.. i have converted my psd file into html/css.. now i want to move my webpage page into center of the window.. i tried some code and that code align only text the background image "back.gif" remains at left.. here is my html and CSS code"
**HTML**
<body>
<div id="main">
<div id="header">
<div id="logo">
<img src="logo.gif" />
</div>
</div>
<div id="menu">
<img src="images/menu_07.gif" />
<div id="m">
<ul>
<li> Home</li>
<li> Pages</li>
<li> Donor</li>
<li>Seeker</li>
<li>Hospitals</li>
<li>Life Saving Contacts</li>
<li>Feedback</li>
</ul>
</div>
</div>
<div id="content">
<div id="center" align="center">
<h3>WELCOME TO ADMIN AREA</h3>
<p id="ajk">AJKBLOODBANK.COM</p>
<?php
echo "welcome!".$_SESSION['username'];
echo "<br>";
echo "<a href=logout.php>Logout</a> ";
?>
</div>
</div>
<div id="footer">
</div>
</div>
</body>
**CSS**
body
{
background:url(../back.gif) repeat-y;
padding-left:105px;
height:900px;
text-align: center;
margin:auto;
min-width: 760px;
}
div#main
{
width: 720px;
margin: 0 auto;
text-align: left;
}
#header
{
width:787px;
margin-top:10px;
}
#menu
{
width:787px;
float:left;
margin-top:20px;
}
#content
{
background-color:#FFF;
border:groove;
width:790px;
float:left;
padding-top:30px;
margin-top:30px;
}
#footer
{
float:left;
height:52px;
width:790px;
}
Please tell me where i made mistake ..
the diameseion of background image "backgif" = 995x1000
Whichever element you want centered - set an explicit width and then set left/right margins to auto
#main { width:995px; margin:0 auto; }
...this will center the element in its parent. If you were to center #main, it would be centered on the page (assuming your body has 100% width)
EDIT
Try making your background image apply to #main instead of body. Or, center the background image using background-position, or shorthand:
body { background:url(../back.gif) repeat-y center top; }
Cheers
To center the body element, I would use something similar to this:
.body {
width: 940px;
margin-left: auto;
margin-right: auto;
}