Columns are not consistent with same CSS - html

I have the exact coding in my html for each of these columns and I'm not sure what I've changed in my css to make the columns all look so different. The left column is the style and positioning that I want. I don't understand how all the more buttons are different and how the more button on the right is completely separate from the grey box even though they are in the same div...I'm new at this so any help would be greatly appreciated!
I will add a jsfiddle to show all of the code and I'll add a portion of the code here: https://jsfiddle.net/40bnatg3/
Also here is a picture of the problem:
<div class="column-center">
<div id= "middle-box">
<h2> Objectives</h2>
<img class="img" src="techpic4.jpg" alt="example web page" width="200" height="200" />
<p >Upon successful completion of the course the student will:
1) Demonstrate competency in the following computer software applications or
practices;
a. HyperText Markup Language (HTML5)
b. Cascading Style Sheets (CSS3)
c. Photoshop
d. IFirefox, Chrome, Safari, IE
e. FTP clients (Fetch, Filezilla, etc.)
2. Design web pages of various complexities.
3. Understand terminology used in web publishing.
4. Discuss the importance of graphic applications and their relationship to the graph
-
ic communications industry.
<br>
<a id="button2" href="msum.css" class="more">More</a>
</p>
</div>
</div>

Remove position:relative from .column_center style class definition:
.column-center{
display: inline-block;
width: 30%;
padding: 1%;
bottom: 18px;
}
Also, you will have to remove a br tag that is between left colum html and center column html in line 49.
Then you will have to change the button1 id definition to:
#button1{
color:black;
top: 35px;
width: 30%;
padding: 1%;
position: relative;
display: inline-block;
font-weight:bold;
}
Edit:
I think it is cleaner for your code to remove all the css styles for #button1, #button2 and #button3 and just leave the style for class .more like this:
.more {
position: relative;
display:inline-block;
color:black;
font-weight: bold;
top: 20px;
right: 31px;
background-color: white;
border-bottom-left-radius: 10px;
padding: 5px;
margin: 10px;
width: 30%;
}

Related

Sections repeatedly overflowing

I am still working on improving my first website project. One issue that is repeatedly causing me a headache is that some sections keep overflowing into those above. When I say overflow, I mean that when I click on the element in brackets, when hightlighted in the live preview, it is showing the margins to actually be around other content above (as shown in picture). This is happening with various sections of my website an I cannot understand why. I am a total beginner here so i'm sure theres a simple reason as to why and how to fix it universally across the website.
Overflow issue in this image
For some sections I can overcome this with the 'overflow: none" property but ideally i'd like to solve this without the need to repeatedly use it. Note, the overflow none property isnt working for all sections, in particular the one I have shown an image of. Could anyone give some clarity here please?
html {
box-sizing: border-box;
}
* {
margin: 0;
padding: 0;
}
body {
background-color: #f6f8fa;
color: #4E6E9B;
font-family: 'Signika', sans-serif;
font-weight: 'E';
}
/* END GENERAL STYLES -----------*/
.one-third-container {
float: left;
width: 100%;
overflow: hidden;
}
.about-one-third {
width: 33.3333%;
padding: 2% 0;
float: left;
text-align: center;
background-color: #0066B2;
color: #f6f8fa;
}
.about-one-third i {
font-size: 8rem;
padding-bottom: 5%;
}
/* END ONE THIRD SECTIONS ------*/
.services-offered {
padding-left: 0;
margin: 2% 5%;
-webkit-padding-start: 0;
list-style-type: none;
overflow: none;
}
.services-offered li {
display: inline-block;
width: 20%;
vertical-align: top;
padding: 0 0 0 1.8rem;
text-align: justify;
}
.services-offered li:before {
content: "\f00c";
font-family: FontAwesome;
width: 1.8rem;
margin-left: -1.8rem;
margin-right: 0.5rem;
}
/* END SERVICES OFFERED ---------*/
<!DOCTYPE html>
<html>
<head>
<title>W Gooderham Gas Services</title>
<link href="https://fonts.googleapis.com/css?family=Raleway:200,700|Signika:300" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"/>
</head>[enter image description here][1]
<div class="one-third-container">
<section class="about-one-third">
<td>
<i id="third-border" class="fa fa-calendar"></i>
</td>
<h2>Routine Servicing</h2>
</section>
<section class="about-one-third" id="centre-third">
<td>
<i id="third-border" class="fa fa-wrench"></i>
</td>
<h2>Installation</h2>
</section>
<section class="about-one-third" id="breakdown">
<td>
<i class="fa fa-snowflake-o"></i>
</td>
<h2>Breakdowns</h2>
</section>
</div>
<! END ONE THIRD SECTION --------------------->
<ul class="services-offered">
<li>
Installation and commission of natural gas central heating systems.
</li>
<li>
Routine servicing of all natural gas appliances including warm air units.
</li>
<li>
If any of your gas appliances breakdown, we provide a 7 day a week callout service to get them back up and running.
</li>
<li>
We can provide gas safety landlord certification for all gas appliances in your properties.
</li>
</ul>
The reason the elements "overflow" to the elements above is because you used float: left; on the class one-third-container (which is fine!). But if the element below doesn't have any float you get the unwanted result of the element getting pushed higher than intended. If you add float:left; to the ul (or the class services-offered) you can prevent this issue.
Edit: Removing the float:left would also work in this case, as the element doesn't need to be floated.
Edit 2: Floats are indeed not that much of the go-to-choice as they were a few years ago. Uncleared elements are a common issue when using floats, which is why flexbox is considered to be better. Flexbox has alot of use cases that simplify many layout problems, that are a little trickier to solve without flexbox. However using flexbox on every element without paying any thought to it can produce unwanted results like for example this:
.container {
height: 500px;
display:flex;
}
<div class="container">
<img src="http://via.placeholder.com/350x150">
</div>
In the code snippet the image is skewed. You can fix this pretty easily by adding align-items to the .container, but the point is, that using flexbox on all elements can possibly cause issues, where they are unneccessary.
That said, using flexbox is definitely a good thing as long as you are paying attention to the elements you're applying it to.

position: fixed gets in way of anchor?

body {
margin: 0px;
background-color: rgba(195, 246, 255, 0.48);
}
.nav {
background-color: rgba(190, 190, 190, 0.72);
position: fixed;
top: 0px;
right: 0px;
left: 0px;
text-align: center;
height: 85px;
border: 1px solid black;
}
ul {
position: relative;
top: 6px;
left: 360px;
width: 450px;
height: 60px;
margin: 0px auto;
font-family: "Cairo";
padding: 5px;
}
li {
position: relative;
top: 6px;
display: inline;
font-size: 25px;
text-transform: uppercase;
letter-spacing: .03em;
}
li.spacing1 {
margin-right: 25px;
}
li.spacing2 {
margin-left: 25px;
}
li:hover {
border: 1px solid red;
padding: 5px;
}
.content {
background-color: white;
width: 1100px;
margin: 87px auto 0px auto;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="../css/example.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Cairo" rel="stylesheet">
<title>My Portfolio</title>
</head>
<body>
<div class="nav">
<ul>
<li class="spacing1">About</li>
<li>Portfolio</li>
<li class="spacing2">Contact</li>
</ul>
</div>
<div class="content">
<p id="about">My name is Lawrence Yoon and I graduated from Cal Poly Pomona with a degree in Hospitality Management and minor in Business Marketing. After working in the hospitality industry for 5+ years, I wanted to expand my knowledge by trying out different
career paths and happened to find out about computer programming. I've been self-learning for 3+ months, and hope to become a front-end web developer soon! I am proficient with HTML and CSS, and have some knowledge of JavaScript. Once I get my first
job, I hope to continue studying and eventually learn back-end. My goal is to one day become a full-stack developer!</p>
<p>So far, I have knowledge of HTML, CSS, Bootstrap, JavaScript, and jQuery. I have used StackOverflow a couple times, and although I don't rely on this, it's great to ask questions and receive answers promptly from a loving community. Jon Duckett's
Introduction to HTML and CSS has been a great teacher to me thus far; although it's a bit dated, it contains detailed images and helped me greatly step foot into the world of web development. Following this book, I got his second book for JavaScript
and jQuery and have started to read through that. While I'm doing this, I'm learning from FreeCodeCamp, which immensely helped because through their projects, I'm able to make this file on Codepen, which will become my portfolio! I will definitely
try to finish all FCC challenges, and make a couple of apps to showcase my skills!</p>
<p>As of right now, I'm not looking for a job because I lack the skills necessary to get my first job in web development. In a couple of months, I hope to polish what I know so far as well as learn new skills to get my first job. In time, I will showcase
my skills by demonstrating my abilities through the makings of small apps. Thanks for reading! Please don't hesitate to reach out to me to provide tips, or if you want to talk about anything I'm all ears!</p>
<p id="portfolio">Portfolio:</p>
<img src="http://res.cloudinary.com/lyoon/image/upload/v1503300012/06_10_16_buqi65.jpg" alt="Beautiful sunset in Redondo Beach" width="300" height="300">
<img src="http://res.cloudinary.com/lyoon/image/upload/v1503299864/01_30_16_2_d1ntei.jpg" alt="Gray day in Redondo Beach" width="300" height="300">
<img src="http://res.cloudinary.com/lyoon/image/upload/v1503299922/02_01_16_wbmyow.jpg" alt="Water in Redondo Beach" width="300" height="300">
<img src="http://res.cloudinary.com/lyoon/image/upload/v1503300012/06_10_16_buqi65.jpg" alt="Beautiful sunset" width="300" height="300">
<p>Contact me here:</p>
<input type="text">
<br>
<input type="text">
<br>
<input type="text">
<br>
<input type="submit" value="Send">
<p id="contact">Here's where you can get in touch with me! Here, you can request for my resume, get more details on my experience, or learn more about my favorite hobbies! I will reply as soon as I am able, thanks!
</div>
</body>
</html>
Two questions:
I have my position: fixed nav-bar that is blocking my anchor tags (about, portfolio, contact), meaning when I click them, it takes me to their location but the nav-bar is blocking the start. When I click the links on the top, how can I make it so that it starts below my nav-bar?
I am using CSS li:visited {text-decoration: none;} but it changes to color purple and still have an underline. Why is that happening?
To resolve the issue with in-page anchors and a fixed header, what you need to do is to create and relatively position an anchor element above the content section.
Fiddle example: https://jsbin.com/dosalajotu/edit?html,css,output
For example, if your header was 50px tall:
header { height: 50px; }
.anchor { position: relative; top: -50px; }
<section>
<div id="about" class="anchor"></div>
</section>
With the :visited state, this would apply to a elements, not to li elements. If you update your CSS selector and also override the colour, that should resolve the issue.
li a:active, li a:visited { color: red; text-decoration: none; }

HTML5 CSS3: <hr> works fine in Chrome. Appears to right of web page in Firefox

I upgraded to the most recent version of Firefox, but this is still happening. It works fine in Chrome. Instead of my horizontal rule appearing near the bottom of the page where it belongs, I have a 1024 pixel line appearing to the right of my web page in firefox.
HTML5:
hr {
height: 2px;
width: 1000px;
border-color: #938FEB;
margin-left: 12px;
margin-right: 12px;
}
footer {
background-color: black;
width: 1024px;
}
<footer>
<p/>
<hr/>
<p style="text-align:center;">Home | E-Mail Form | Calendar |</p>
<br/>
</footer>
I have no clue what's causing this. Thank you
You need to be clearer with what you're trying to achieve, also please post jsfiddles so we have something to work from or indent your code.
hr {
height: 2px;
width: 1000px;
border-color: #938FEB;
margin-left: 12px;
margin-right: 12px;
}
footer {
background-color: black;
width: 1024px;
}
<footer>
<p/><!--(Not valid)-->
<hr/>
<p style="text-align:center;">
Home | E-Mail Form | Calendar |
</p>
<br/>
</footer>
http://jsfiddle.net/25zcvws2/
Rather than setting exact px measurements, I think you'd be better either using percentage units, or additionally using calc, both of which are shown below. This way, you'll make your code responsive as well as more efficient by making the following alterations.
Removed redundant closing p tag
altered width of both footer and hr element (as described above)
added a color to footer to allow text elements to appear
placed text-align property in css
Added a font coloring to display the other text for demo only (i'm presume this has been left out for demo purposes by OP, i've just added one in)
This can be seen below:
hr {
height: 2px;
width: calc(100%-24px);
border-color: #938FEB;
margin-left: 12px;
margin-right: 12px;
}
footer {
background-color: black;
width: 100%;
color:red;
}
footer p{
text-align:center;
}
<footer>
<hr/>
<p>Home | E-Mail Form | Calendar |
</p>
<br/>
</footer>

Setting the height of a span element to 100%

I'm currently building a theme / style for a piece of software.
Currently, the code looks like such:
http://jsfiddle.net/afseW/1/
The relevant code is:
body div[type*=privmsg] .sender {
font-weight: 700;
width:134px;
text-shadow: #fff 0px 1px;
background-color: #eee;
min-height:22px;
border-right: 1px solid #dcdcdc;
padding-right:5px;
text-align:right;
display:inline-block;
overflow: auto;
}
Note that in fiddle, for some reason, the text is collapsing onto the second line, whereas in the client, the image looks like this:
Granted, a span is not meant to be a block, hence I've given it the property of: display: inline-block;
But how do I get the height to inherit the parent p block?
I changed DOM structure. See the inline style. In the first div (.message) I prefer a better solution adding a .clearfix class, see this.
<div class="message" type="privmsg" style="overflow: auto;">
<div class="sender-cont" style="width: 30%; float: left;">
<span class="sender" ondblclick="Textual.nicknameDoubleClicked()" oncontextmenu="Textual.openStandardNicknameContextualMenu()" type="myself" nick="shamil" colornumber="20">+shamil</span>
</div>
<div style="width: 70%; float: left;">
Welcome to <span class="channel" ondblclick="Textual.channelNameDoubleClicked()" oncontextmenu="Textual.openChannelNameContextualMenu()">#textual-testing</span>! This channel is for the users of the Textual IRC Client to test scripts and do other activities in an unregulated environment. — <span class="inline_nickname" ondblclick="Textual.inlineNicknameDoubleClicked()" oncontextmenu="Textual.openInlineNicknameContextualMenu()" colornumber="3">milky</span>'s law states: "On IRC, after a user has executed a command that outputs interesting information to a channel (i.e. /sysinfo), then there will be at least two users that do the same."
</div>
</div>
Hope this helps!
Since the spans are a set width, probably the easiest thing to do here is just make the span have a absolute position.
body div[type*=privmsg] .sender,
body div[type*=action] .sender {
position: absolute;
top: 0;
bottom: 0;
left: 0;
...
}
Then add padding to the parent element:
body span.message {
position: relative;
padding-left: 140px;
...
}
http://jsfiddle.net/afseW/3/
PS: please provide a trimmed down version in jsfiddle next time, the html and css here is pretty epic.

Styling A Link Button Using CSS Across Browsers

UPDATE #2: I have solved almost all my issues bar the one major one. With the same structure and CSS IE7/6 displays each a with 100% width of it's container. I need this to no happen. Besides that everything else is fine. Can anyone enlighten me?
UPDATE: Should Look Like This
I have the following html page (detailed below). It simply renders 2 styled buttons from the links. My problem is IE6 & 7 renders it differently than Firefox, Safari, IE8 and Chrome that all render it correctly.
I have been banging my head against the wall for a day now trying to make it work in IE6/7. Can anyone offer advice as to what I am doing wrong?
Thanks
<html>
<head>
<style>
.niw-button {
background: #1f81c0 url(niw-btn-gradient-normal.png) repeat-x;
border: none;
color: #fff;
display: inline-block;
font-weight: bold;
margin-right: 6px;
min-width: 95px;
padding: 2px;
text-decoration: none;
}
.niw-button:hover {
background: #5e698f url(niw-btn-gradient-hover.png) repeat-x;
}
.niw-button > .niw-button-contents {
border: 1px solid #73b1da;
}
.niw-button > .niw-button-contents:hover {
border: 1px solid #99a1bc;
}
.niw-button .niw-button-icon {
background-position: center;
background-repeat: no-repeat;
float: right;
height: 25px;
width: 27px;
}
.niw-button .niw-button-text {
height: 25px;
line-height: 1.5em;
padding-left: 5px;
padding-right: 27px;
text-align: center;
text-transform: uppercase;
}
.right-align {
float:right;
}
.niw-icon-cancel {
background-image: url(niwater_cancelIcon.png);
}
</style>
</head>
<body>
<a class="niw-button right-align" href="#">
<div class="niw-button-contents">
<div class="niw-button-icon niw-icon-cancel"></div>
<div class="niw-button-text">Cancel</div>
</div>
</a>
<a class="niw-button" href="#">
<div class="niw-button-contents">
<div class="niw-button-icon niw-icon-cancel"></div>
<div class="niw-button-text">Cancel</div>
</div>
</a>
</body>
</html>
EDIT: Now that I understand your image:
Just make your <a> elements block elements with display:block and put some kind of span inside of them to hold the icon. Or you could make the whole thing an image...
IE6/7 doesn't support display: inline-block, IE6 doesn't support the child (parent > child) selector. So you probably should look into those points in your css...
Edit: I actually don't get correct rendering in IE8, which is what I address below:
For a start, you should put the <a> elements inside the elements rather than the other way round. Block level elements shouldn't really exist within inline elements. e.g.
<div class="niw-button-contents">
<div class="niw-button-icon niw-icon-cancel"></div>
<div class="niw-button-text"><a class="niw-button right-align" href="#">Cancel</a></div>
</div>
<div class="niw-button-contents">
<div class="niw-button-icon niw-icon-cancel"></div>
<div class="niw-button-text"><a class="niw-button" href="#">Cancel</a></div>
</div>
This fixes the positioning for me but there is a subsequent loss in styling. I haven't tinkered with the CSS to correct that yet but it should be straightforward. Secondly, you have an awful lot of classes to deal with a straightforward issue. Arguably you should only need one class in the outer div to identify what's happening inside, and then your CSS can descend from there.
Just one tip for a resource to the button/link problem in general:
http://mezzoblue.com/archives/2008/09/17/anchor_butto/
I'm actually confused myself. How are they supposed to look? If you don't let us know what you're intending to do, it's very difficult to fix the problem.