I cannot for the life of me figure out how to make the images within the following code align horizontally across the top. I also need to get the h1's to align the same as well. It seems to behave oddly to me when I use the vertical-align property.
HTML:
<div class='services-banner'>
<div class='service-one'>
<img align='top' src='http://static.squarespace.com/static/515a53e1e4b063d29d1bd369/t/51a17287e4b09448823f89f6/1369535111697/Link%20Icon.png'>
<h1><b>Social Media Marketing</b></h1>
<p class='service-description'>Engage your audience with organic brand growth. We work to connect with your customers through social media and humanize your brand. Our team takes your social media campaign from strategy to action! </p>
</div>
<div class='service-two'>
<img align='top' src='http://static.squarespace.com/static/515a53e1e4b063d29d1bd369/t/51a17290e4b0941ebb86cb78/1369535120489/Web%20Design%20Icon.png'>
<h1><b>Website Design</b></h1>
<p class='service-description'>We offer customized website design to scale your content across platforms. Our design team will produce a clean and focused website. We include search engine optimization, analytics and a intuitive platform to keep your content relevant. </p>
</div>
<div class='service-three'>
<img align='top' src='http://static.squarespace.com/static/515a53e1e4b063d29d1bd369/t/51a1728be4b034b67e50db59/1369535115782/Search%20Engine%20Marketing%20Icon.png'>
<h1><b>Search Engine Marketing</b></h1>
<p class='service-description'>Visibility is everything. Project your brand across the internet with search engine marketing. Our team will customize and execute a potent add campaign. We offer customized text or visuals for your brand! </p>
</div>
<div class='service-four'>
<img align='top' src='http://static.squarespace.com/static/515a53e1e4b063d29d1bd369/t/51a17289e4b0f957dd565595/1369535113477/Review.png'>
<h1><b>Reputation Management</b></h1>
<p class='service-description'>Studies show, product endorsements effect consumer behavior. Our team uses the latest in SEO technology to scour the internet in search of negative press. We create a plan of action to manage reviews by responding to consumers concerns. </p>
</div>
CSS:
.services-banner {
width: auto;
height: auto;
display: block;
position: absolute;
text-align:center;
overflow: hidden;}
.service-description {
text-align:left;
font-weight: 400;
}
.service-one {
width: 225px;
height: 500px;
display:inline-block;
padding: 10px;
background-color: transparent;
}
.service-two {
width: 225px;
height: 500px;
display: inline-block;
text-align:center;
padding: 10px;
background-color: transparent;
}
.service-three {
width: 225px;
height: 500px;
display: inline-block;
text-align:center;
padding: 10px;
background-color: transparent;
}
.service-four {
width: 225px;
height: 500px;
display: inline-block;
text-align:center;
padding: 10px;
background-color: transparent;
}
.services-banner img {
width: 160px;
}
You can see a live example at http://www.ampfly.sqsp.com on the home page. Please excuse the unfinished-ness of the site, its a work-in-progress. Thanks!
Replace display:inline-block; in all your service-one, service-two, service-three and service-four classes with display:table-cell. This will solve your issue.
For instance,
.service-one, .service-two, .service-three, .service-four{
display: table-cell;
}
Here is the Working Solution.
Hope this Helps.
Related
Firstly, I am still learning and fairly new to this profession so feel free to correct the code I have that is wrong.
The issue I have is that on my localhost solution, my css grid code is working the way I want it to (see 1st pic below). When it's uploaded, it is not (see 2nd pic below). I have used a method found on another website (https://css-tricks.com/new-year-new-job-lets-make-a-grid-powered-resume/) and it works on my CV, but it's not working on my portfolio post.
Should look like this!
picture 1
But looks like this...
picture 2
In specifics, the css file (index.css) is getting called for an id on the parent div that contains all the sections of a grid, but the index.css is not getting called for the class in the parent div, nor is index.css being applied to any of the classes on the sections of the grid. In the localhost, index.css is working correctly across these sections. When I check index.css on the server side, it is up to date and has all the classes that I need which is what is making me scratch my head so much...
What I have tried is a 'hard refresh' (ctrl+f5, shift+f5, etc.), turned my Cloudflare into developer mode, and I have also allowed some time to see if it was just a slow upload on the server side.
HTML code;
<div id="banner">
<!--Title-->
<div class="container py-2">
<div class="col-12 py-0 px-2">
<h3><u>KPI Management Dashboard</u></h3>
</div>
</div>
</div>
<div class="portfolio-sections" id="content">
<section class="grid-area-portfolio portfolio-overview" style="margin-left: 15px;">
<div class="p-3">
<p style="color: #545454;"><b>OVERVIEW</b></p>
<p>
text here
</p>
<p>
text here
</p>
</div>
</section>
<section class="grid-area-portfolio portfolio-role" style="margin-left: 15px;">
<div class="p-3">
<p style="color: #545454;"><b>MY ROLE</b></p>
<p>
<b>Graduate Software Developer</b> for Nant Ltd
</p>
<p>
UI Design, Prototyping, HTML, CSS, JavaScript, PHP, MySQL
</p>
<p>May 2020 - July 2020</p>
Go to the Dashboard Page
</div>
</section>
CSS code (index.css);
#banner {
margin-top: 100px;
width: 100%;
background-color: #ffffff;
/*color: #545454;*/
/*border-top: 2px solid rgba(82,82,82,0.4);
border-bottom: 2px solid rgba(82,82,82,0.4);*/
box-shadow: rgba(0, 0, 0, 0.3) 0 5px 10px 0;
}
#banner h3 {
color: #545454;
border-top: 4px solid rgba(255,255,255, .95);
transition: border-top ease-in-out 0.25s;
border-radius: 3px;
display: inline-block;
}
#banner h3:hover {
border-top: 4px solid #AFFC41;
border-radius: 3px;
}
#content {
margin: 0 auto;
margin-top: 20px;
width: 75%;
padding-bottom: 40px;
background-color: #ffffff;
box-shadow: rgba(0, 0, 0, 0.3) 0 5px 10px 0;
display: grid;
}
.portfolio-sections {
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: auto;
grid-template-areas:
"portfolio-overview portfolio-overview portfolio-role"
"portfolio-background portfolio-background portfolio-background"
"portfolio-problem portfolio-problem portfolio-problem"
"portfolio-users portfolio-users portfolio-users"
"portfolio-solution portfolio-solution portfolio-solution"
"portfolio-results portfolio-results portfolio-results";
}
.grid-area-portfolio {
padding: 0;
margin: 15px 15px 0px 0px;
position: relative;
}
.portfolio-overview {
grid-area: portfolio-overview;
}
.portfolio-role {
grid-area: portfolio-role;
}
A link to this codepen shows it works there - https://codepen.io/gileswking/pen/abdgOVo
But a link to my actual site shows it doesn't work there - https://www.code-grey.co.uk/portfolio/dashboard_case_study.php
I would appreciate any help, and many thanks in advance.
So it turns out if I click Development Mode on my Cloudflare CDN, it works for 24 hours, then disables itself which implies it's an improper setup on Cloudflare. After going through the setup with a friend, it is now working.
I have some pseudo code like this:
<div class="container">
<div class="hiddenatfirst">
<img>
<img>
<img>
</div>
</div>
and css like so:
.hiddenatfirst{
display:none;
}
.container:hover .hiddenatfirst{
display:block;
}
.hiddenatfirst:hover{
display:block;
}
The problem is - I have a design website and a lot of visitors have the pinterst extension installed. When someone hovers over the pin-it button that gets added to the images inside the .hiddenatfirst div the div gets hidden again.
I don't want to remove the pin-it buttons from the images but I don't want them to get in the way of the :hover events.
Any ideas?
Apologies for the pseudo-code, the real code is pretty messy and in staging! Hopefully this explains what I need.
Thanks
PS - if you look at the .third-level-menu in the navigation here you'll see it in action (note you'll need the pinterest chrome extension installed)
http://smith-hoyt.myshopify.com/?preview_theme_id=12397927
PPS - this is a crappy GIF but I think shows what's happening too:
http://recordit.co/anNtu8W1Vo
PPPS - you can see the pin-it button that pinterest adds to each image in this image: https://twitter.com/tomcritchlow/status/573920066124836864/photo/1
Most probably the problem is that 'Pin it' button is absolutely positioned on top of the image, but it's not the container's child, so hover on it hides the image like on the following sample:
.container {
display: block;
width: 500px;
height: 315px;
background-color: gray;
}
.hiddenatfirst {
display: none;
}
#pinit {
position: absolute;
top: 32px;
left: 32px;
}
.container:hover .hiddenatfirst {
display: block;
}
.hiddenatfirst:hover {
display: block;
}
<div class="container">
<div class="hiddenatfirst">
<img src='https://dq1eylutsoz4u.cloudfront.net/2014/10/sf-cat.jpg' />
</div>
</div>
<img id='pinit' src='http://www.brandaiddesignco.com/insights/PinIt.png' />
What you can do is using JavaScript or jQuery find all the 'Pin it' buttons and move them to the appropriate containers with the positions recalculation, so the result HTML will be like the following:
.container {
display: block;
width: 500px;
height: 315px;
background-color: gray;
}
.hiddenatfirst {
display: none;
}
#pinit {
position: absolute;
top: 32px;
left: 32px;
}
.container:hover .hiddenatfirst {
display: block;
}
.hiddenatfirst:hover {
display: block;
}
<div class="container">
<div class="hiddenatfirst">
<img src='https://dq1eylutsoz4u.cloudfront.net/2014/10/sf-cat.jpg' />
<img id='pinit' src='http://www.brandaiddesignco.com/insights/PinIt.png' />
</div>
</div>
Rather than use the javascript solution above, since these images are small and in the navigation I found a way to remove the pin-it button, simply add to each image:
nopin="nopin"
As per the documentation here:
https://developers.pinterest.com/on_hover_pin_it_buttons/
Div tags seem to be concluding on the wrong ending tag but I must've counted them a hundred times. I don't understand what's wrong. My boss says it needs to look good in Dreamweaver even though I've checked it in Mozilla, Safari and Chrome. Problem is that even though I'm using Sublime Text 2, some div tags are still showing that they conclude on the wrong closing div tag. So it looks all screwed up in Dreamweaver. Like I said, I must've counted it a hundred times and I'm at a complete loss. Does anyone have any suggestions? And also more importantly, any explanations for why this is happening in two different text editors? It might be something really silly that I'm doing but I just don't see what it is... Any help? The problem is most notable with the first opening div tag. On the way down it says it concludes at the bottom closing tag. But on the way up it says that the closing tag's source is somewhere in the middle. I just don't get it... UPDATED WITH THE CHANGES MADE. Now it looks better but the div tags still resolve on the wrong lines. Dreamweaver no longer is throwing an error but it still resolves in a weird way.
<style>
.landingWrapper{
font-family: Arial, sans-serif;
font-size: 14;
width: 784px;
display: block;
}
.blockIt {
display: block;
}
.clearIt {
clear: both;
min-height: 50px;
}
.margins {
margin-left: 35px;
margin-right: 35px;
}
.introText {
margin-bottom: 50px;
}
#listHeading {
background: #eceeef;
margin: 6px 13px;
}
#camera {
width: 354px;
height: 380px;
}
#camera, .listWrap {
display: inline-block;
}
.listWrap {
margin-left: 8px;
}
.benefitsList {
width: 422px;
float: left;
margin-top: 0;
}
.cameraDiv {
width: 354px;
float: left;
margin-top: 3px;
}
.heading {
margin-left: 25px;
width: 430px;
height: 40px;
background: #eceeef;
vertical-align: middle;
}
.heading #listHeading{
margin-top: 4px;
padding-top: 12px;
background: #eceeef;
font-size: 16px;
font-weight: bold;
vertical-align: middle;
}
.ulBenefits li{
margin-bottom: 7px;
border-bottom: 1px solid #eceeef;
font-size: 12px;
font-family: Arial, sans-serif;
list-style-type: disc;
padding: 0;
}
.ulBenefits li p{
margin: 5px 0;
padding: 0;
}
#headingTwo {
margin-top: 30px;
}
#secondaryText {
margin-bottom: 25px;
width: 714px;
}
.diagrams{
margin-bottom: 15px;
min-height: 50px;
width: 713px;
height: 195px;
}
.infoBox{
border: 1px solid #eceeef;
border-top: 10px solid #eceeef;
width: 211px;
display: block;
margin-left: 35px;
margin-top: 15px;
float: left;
}
.infoBox p {
margin-left: 6px;
margin-right: 6px;
}
#walkieTalkieOne {
width: 209px;
height: 186;
}
#walkieTalkieTwo {
width: 210px;
height: 186;
}
#walkieTalkieThree {
width: 211px;
height: 186;
}
.infoHeader {
font-weight: bold;
font-size: 18px;
}
.infoDesc{
margin-bottom: 15px;
}
.closer {
display: block;
margin-top: 50px;
clear: both;
position: relative;
top: 25px;
}
#resellerButton {
margin-bottom: 50px;
clear: both;
position: relative;
top: 25px;
}
#resellButtLink{
text-decoration: none;
clear: both;
position: relative;
top: 25px;
}
</style>
<div class="landingWrapper">
<div class="blockIt">
<img id="hero" alt="Your CAMCORDER. DIGITAL Sound. AFFORDABLE price." src="images/hero.jpg">
</div>
<div class="blockIt">
<img id="headingOne" alt="Sony’s new UWP-D Series wireless mics deliver high-quality sound with digital audio processing." src="images/headerOne.jpg">
</div>
<div id="introText" class="margins">
<p class="margins">Now you can get the digital sound quality you want at an affordable price. With more than 50 years of microphone innovation, Sony introduces the new UWP-D wireless microphone system. Just because your project is budget-driven doesn't mean you have to compromise on sound quality.</p>
<p class="margins">Sony's new wireless mics are the ideal audio-for-video solution that will boost the performance of even entry-level camcorders. Choose from among three packages, any of which are well-suited for ENG and field production or any budget-conscious application requiring high-quality digital audio.</p>
</div>
<div class="clearIt blockIt listWrap benefitsList">
<div class="heading">
<p id="listHeading" class="margins">Key Benefits:</p>
</div>
<ul class="ulBenefits">
<li><p>Wide range with up to 72 channels</p></li>
<li><p>Three separate UHF frequency blocks available</p></li>
<li><p>USB Portable Charger w/Lithium-Ion Battery and AC adapter</p></li>
<li><p>Sturdy metal body construction</li>
<li><p>Digital audio processing</li>
<li><p>A DSP compander provides superb transient response performance</p></li>
<li><p>Wide switching RF bandwidth with 3 UHF frequency blocks available</p></li>
<li><p>True diversity receiver for stable reception</p></li>
<li><p>Output audio gain control on receiver</p></li>
<li><p>Headphone output on receiver</p></li>
<li><p>Handheld TX includes interchangeable capsule design</p></li>
<li><p>Mic or line input on both body-pack and plug-on transmitters</p></li>
<li><p>Sony UWP/800 Series & Legacy Analog Wireless System compatibility</p></li>
</ul>
<div class="blockIt cameraDiv">
<img id="camera" alt="Camera" src="images/camera.jpg">
</div>
</div>
<div class="clearIt blockIt">
<img id="headingTwo" alt="Digital Sound Innovation for Analog Systems" src="images/headerTwo.jpg">
</div>
<div id="secondaryText" class="blockIt">
<p class="margins">Sony knows that exceptional sound quality is the most important issue in wireless transmission. While conventional analog systems use companders to provide dynamic range, the sound quality and transient response performance are not without flaws.</p>
<p class="margins">That's why Sony has developed a digitally processed sound solution that uses DSP (digital signal processing). The UWP-D Series utilizes a DSP compander that achieves high quality digital sound, all at an affordable price. DSP optimizes the audio signal processing between the transmitter and receiver, providing superb transient response performance.</p>
<p class="margins">With easy-to-use automatic channel setting mode, clear channel and active channel scan, IR sync and unprecedented frequency coverage, you will never look at sound the same way again.</p>
</div>
<div class="blockIt">
<img class="margins diagrams" id="diagramOne" src="images/diagramOne.jpg">
</div>
<div class="blockIt">
<img class="margins diagrams" id="diagramTwo" src="images/diagramTwo.jpg">
</div>
<div class="infoBox">
<img id="walkieTalkieOne" alt="UWP-D11" src="images/walkieOne.jpg">
<p class="infoHeader">UWP-D11</p>
<p class="infoDesc">Is well suited for a wide range of applications, from news gathering and interviews to talk shows and conferences.</p>
</div>
<div class="infoBox">
<img id="walkieTalkieTwo" alt="UWP-D12" src="images/walkieTwo.jpg">
<p class="infoHeader">UWP-D12</p>
<p class="infoDesc">Is widely used for interviews and news gathering and features a newly designed handheld transmitter.</p>
</div>
<div class="infoBox">
<img id="walkieTalkieThree" alt="UWP-D16" src="images/walkieThree.jpg">
<p class="infoHeader">UWP-D16</p>
<p class="infoDesc">Is ideal for interviews and news gathering and features UTX-P03 plug-on bodypack transmitter.</p>
</div>
<p class="closer margins">Contact your Sony authorized reseller today and and discover the high-quality sound of digital audio processing.</p>
<a id="resellButtLink" href="http://pro.sony.com/bbsc/ssr/product-UWPD11/42"><img id="resellerButton" class="margins" alt="Find a Reseller" src="images/button.jpg"></a>
</div>
If the browsers are rendering just fine maybe it is because they know you don't have to close a <p> or something like this, and your text editor does not know it.. Try closing everything or changing the doctype inside your editor configuration.
Firefox has a good feature when viewing the code, it paints problematic tags in red.
Also, you have two class declaration at <div class="introText" class="margins">
<div id="blockIt secondaryText"> on line 204
I think it should have been
<div class="blockIt" id="secondaryText">
Also, line 174
<div class="introText" class="margins">
should be
<div class="introText margins">
Not closed <p> tags on lines 186&187
You aren't posting your encoding. If you're using strict html encoding you have to close your img tags also [ex: <img src="" alt="" />]. I've seen in your update that you closed all the p tags. Maybe this is all that's left to do.
I am programing a webpage with html and CSS. My pseudo class :hover stopped working on my webpage, but :focus still works. Hover was working fine, and then I made an unrelated edit (added an image to one of my blocks), and noticed it had stoped working. I deleated my last change and it still did not work.
I have checked everything and ran both the html and css through validators and there are no errors other than something about using character encoding, but I know it worked fine without that. It really makes no sense!
I will show my page and my code. Keep in mind this is my very first webpage, I know that I did not optimize my background images properly, and may have some unnecessary divs, but I feel pretty good about it considering a week ago I did not know what html was. I have heavily commented and organised my CSS, you can find my hover code near the top along with the rest of the none classes/ID's. The hover link is the only link on the webpage on the sidebar.
http://www.adrianhoulewebprojects.com/HomePage.html
Here is my HTML
<!--Home Page for adrianhoulewebpojects.com Version 1.0-->
<!--Written by Adrian Houle-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/HomePageStyle.css">
<title>Adrian Houle Web Projects</title>
</head>
<body>
<div id="Sidebar">
<h3>Projects</h3>
<ul>
<li>
Under Construction
</li>
<li>Unfinished Project #2</li>
<li>Unfinished Project #3</li>
<li>Unfinished Project #4</li>
<li>Unfinished Project #5</li>
</ul>
</div>
<div class="box">
<div class="HalfSpacer"></div>
<div class="TransBox" id="Header">
<h1>Welcome to<br>AdrianHouleWebProjects.com</h1>
</div>
<div class="Spacer"></div>
<div class="TransBox" id=About>
<h2>About:</h2>
<p>Welcome to my website. I had a bit of time over the holidays and decided to finally get around to learning web programming. The purpose of this website is to give me a place to practice and display what I learn in the form of web projects. I may also be making some blogs that will also serve to showcase my travelling and hobbies.</p>
</div>
<div class="Spacer"></div>
<div class="TransBox" id="NewStuff">
<h2>Coming Soon</h2>
<ul>
<li>
<h3>Australia Travel Blog</h3>
<img src="http://www.adrianhoulewebprojects.com/img/AustralianFlag100by50.gif" alt="Australian Flag" >
<p>2013-2014 Australia Travel Blog coming soon.</p>
</li>
</ul>
</div>
<div class="Spacer"></div>
<div class="TransBox" id="Contact">
<h2>Contact Info:</h2>
<p class="Italic">Please report any compatibility, accessibility, or security issues to:</p>
<p>Adrian Houle</p>
<p>adrianhoule#gmail.com</p>
</div>
<div class="Spacer"></div>
<div class="TransBox" id="Footer">
<p>Website by Adrian Houle</p>
</div>
</div>
<div class="BottomBorder"></div>
</body>
</html>
Here is my CSS
/***************************************** Info *********************************************************/
/*Style Sheet for HomePage of adrianhoulewebprojects.com*/
/*Written by Adrian Houle*/
/*For any issues with my website (compatibility, accessibility, white-hat reports) feel free to contact me at
adrianhoule#gmail.com
/*Page Purpose: Create a homepage that welcomes users to my website and directs them to various projects*/
/***********************************************************************************************************/
/************************************* Table of Contents **************************************************/
/*CSS layout*/
/* -none specific elements*/
/* -classes*/
/* -ID's and children of ID's*/
/* -Other*/
/************************************************************************************************************/
/************************************** CSS code ****************************************************/
/* -none specific elements ***********************************************************************************/
p {
font-size: large;
font-weight: bolder;
}
a {
color: blue;
}
a :hover, :focus{
background-color: yellow;
text-decoration: none;
font-size: larger;
}
/* -classes **************************************************************************************************/
/*Element that contains everything except the sidebar and has the main background image.*/
.box {
display: block;
position: relative;
width: 100%; /*test and adjust to keep it from expading the browser*/
height: 100%;
border: 3px solid black;
right: 0;
top: 0px;
padding: 0;
background-image: url(http://www.adrianhoulewebprojects.com/img/CautionStripes.png);
}
/*Allows for synchronised space adjustment between elements*/
.Spacer {
position :relative;
height: 100px;
}
/*Allows for synchronised space adjustment between elements*/
.HalfSpacer {
position :relative;
height: 30px;
}
/*Every element that contains text belongs to this class*/
/*This class has nothing to do with transgender boxes, or gender boxes in general*/
.TransBox {
width: 70%;
padding: 1em;
z-index: 1;
left: 20%;
position: relative;
background-image: url(http://www.adrianhoulewebprojects.com/img/SteelPlate.jpg);
moz-box-shadow: 0 0 5px 5px #888; /*shadow effect with cross compatibility*/
webkit-box-shadow: 0 0 5px 5px#888;
box-shadow: 0 0 5px 5px #888;
}
.Italic {
font-style: Italic;
}
/* -ID's and children of ID's********************************************************************************/
/*Sidebar, to be fixed to the left hand side of the screen. Must allow conent to the right of it*/
#Sidebar {
height: 100%;
width: 10%;
left: 0px;
top: 0px;
padding: 2%;
display: inline;
position: fixed;
background-image: url(http://www.adrianhoulewebprojects.com/img/SteelPlate.jpg);
border-style: solid;
border-width: 3px;
z-index: 2;
}
#Sidebar ul {
padding-left:0;
}
#Sidebar li {
margin: 10%;
}
/*Header text*/
#Header h1 {
text-align: center;
}
#Footer p {
text-align: center;
}
/* -Other (empty)*****************************************************************************************/
Thank you for any help.
CSS is very touchy about putting extra spaces in it. Combine a with :hover like this:
a:hover, a:focus{
background-color: yellow;
text-decoration: none;
font-size: larger;
}
Also want to make it a:focus unless you want every element to be affected.
Remove the space between a and :hover
a:hover{
background-color: yellow;
text-decoration: none;
font-size: larger;
}
I'm using twitter bootstrap for my css and the following code has an issue with the alignment:
see jsfiddle here: http://jsfiddle.net/graphicsxp/99rhF/ (make sure you enlarge the html view)
<div class="view-header">
<span class="view-title">Recherche de mandats</span>
<div class="pull-right">
<a style="line-height: 30px; margin-right: 20px; vertical-align: bottom; float: left;">
<span class="pointer">more options</span>
</a>
<form class="form-inline pull-left" placeholder="N° de contrat, nom/numéro de client" css-class="input-xxlarge">
<input class="input-xxlarge ng-dirty" type="text" placeholder="N° de contrat, nom/numéro de client" ng-model="model">
<button disabled="disabled" class="btn btn-info" type="submit"><i class="icon-search"></i> Rechercher</button>
</form>
</div>
<div class="clearfix"></div>
<div class="pull-right">
</div>
<div class="clearfix"></div>
</div>
as you can see the button with the label 'Rechercher' is too far right. What am I doing wrong ?
There is nothing wrong with your button, its the containing element.
Update the css with:
.view-header {
background-color: #F5F5F5;
border-bottom: 1px solid #BBBBBB;
margin-bottom: 20px;
padding: 10px 20px;
}
Removing width: 100%; Div's are block line elements, meaning they will fill their parent. This should solve your problem.
See:
http://jsfiddle.net/99rhF/2/
The parent element has a width of 100%, but padding isn't included in width calculations, so it ends up being 100% + 40px. You fix this by wrapping the contents in a container, and padding that instead.
http://jsfiddle.net/ndTuL/
.view-header {
background-color: #f5f5f5;
width: 100%;
margin-bottom: 20px;
border-bottom: solid 1px #bbbbbb;
}
.content-wrap {
padding: 10px 20px 10px 20px;
}
First of all, I know I'm late to the party :)
Second - #Jamie Hutber has a very good and valid answer. No arguments here at all - it should remain the accepted answer for sure.
Third - Here's what I ran in to, and how I fixed it:
HTML:
<!DOCTYPE html>
<html>
<head>
<?php echo $str->head; ?>
</head>
<body>
<footer>
© Copyright 2021-$currentYear | All Rights Reserved | No Unauthorized Use Permitted | JPeG Web Development
</footer>
</body>
</html>
<footer> is also a Block Line Element, so width is not needed. Here's what I did instead:
CSS
body {
background-color: #f8f3ed;
max-width: 1200px;
display: flex;
flex-direction: column;
margin-bottom: 2rem;
}
footer {
display: flex;
flex-direction: row;
height: 1.5rem;
font-size: 1rem;
position: absolute;
bottom: 0px;
right: 0px;
overflow: hidden;
max-width: 1200px;
padding: 5px;
}
Things to note is that the position: absolute; will mess up any text-direction and make it overflow, especially if you try and add a width: 100% to it. The right and bottom stick it on the bottom right corner no matter how much you scroll.
It's not exactly what the question was asking, but I thought it might be nice for people to see some alternate ways to have this issue, and resolve it.