Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Joomla v3 with Bootstrap v2 - How to Remove Right Margin

Posted on 2013-11-07
5
Medium Priority
?
668 Views
Last Modified: 2013-11-11
Hi Experts,

I can't seem to remove the right margin nor padding within the header tag which holds three sub-tags namely, header-1, header-2, header-3 even though i specified their values to be 0px as can been seen from the attached image.

Please help.

Thanks in advance,
Rick


Html Codes:

<?php
defined('_JEXEC') or die;

// Add JavaScript Frameworks
JHtml::_('bootstrap.framework');

// Load optional RTL Bootstrap CSS
JHtml::_('bootstrap.loadCss', true);

?>

<!DOCTYPE html>

<html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width", initial-scal="1.0">
        <jdoc:include type="head" />
	
        <!--[if lt IE 9]>
		<script src="<?php echo $this->baseurl ?>/media/jui/js/html5.js"></script>
	<![endif]-->
        
        <!-- <title>Sample Tempalte</title>
        <link href="css/bootstrap.css" rel="stylesheet" type="text/css">
        <link href="css/bootstrap-responsive.css" rel="stylesheet" type="text/css">
        <link href="css/bootstrap-extended.css" rel="stylesheet" type="text/css"> -->
        
        <!-- Custom Fonts -->
        <link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>
        
        <!-- Custom Styles -->
        <link href="templates/alpha1_0/css/custom.css" rel="stylesheet" type="text/css">
    </head>
    
    <body>
        <!-- Header Start -->
        <header class="row-fluid">
                
            <!-- Insert Logo Here -->
            <div id="header-1" class="span4">
                <jdoc:include type="modules" name="header-1" style="html5" />
            </div>

            <!-- Insert Slogan Here -->
            <div id="header-2" class="span4">
                <jdoc:include type="modules" name="header-2" style="html5" />
            </div>

            <!-- Insert Slogan Here -->
            <div id="header-3" class="span4">
                <jdoc:include type="modules" name="header-3" style="html5" />
            </div>
            
        </header>
        
    </body>
</html>

Open in new window


CSS Codes:

@charset "utf-8";
#header-1{
  background-color: red;
  margin-right: 0px;
  margin-left:  0px;
  border: 1px solid black;
}

#header-2{
  background-color: green;
  margin: 0px;
  padding:0px;
  border: 1px solid black;
}

#header-3{
  background-color: blue;
  margin: 0px;
  padding:0px;
  border: 1px solid red;
}

html {
  //width: auto !important;
  //overflow-x: hidden !important;
  border: 1px solid red;
  margin:0px;
  padding:0px;
}
body {  
  //width: auto !important;
  //overflow-x: hidden !important;
  border: 1px solid red;
  margin:0px;
  padding:0px;
  //background-color: yellow;
}

header {
  background:yellow;
  margin:0px;
  padding:0px;
}

Open in new window

website.jpg
0
Comment
  • 3
5 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 39633496
Obviously, something else in the page is affecting the rendering post a link and we can do a diagnostic.

Cd&
0
 
LVL 51

Accepted Solution

by:
Steve Bink earned 2000 total points
ID: 39634855
First and foremost, use Firefox + Firebug to determine exactly how the style is being applied.  It looks like you have your custom style sheet loading after Bootstrap, which is how it should be.  But you're also applying the style to the upper level container elements.  The <jdoc> directive to include the modules is going to create additional elements within that container - elements that can (and probably are) targeted by bootstrap styles.

Use Firebug to determine exactly which element is being targeted by bootstrap.  Then you have the option of either targeting that element in your custom style, or in a worst-case scenario, creating a custom chrome, alternate layout, or core override to replace the HTML currently being generated.
0
 

Author Comment

by:Ronniel Allan Castanito
ID: 39637952
Thank you for both or your replies. I'll will try using Firebug and will post back short.

Cheers
Rick
0
 

Author Comment

by:Ronniel Allan Castanito
ID: 39640440
I found the element that was being targeted by bootstrap.

.row-fluid .span4 {
    width: 31.6239%;
}

The total is not 100% and therefore 5.1283% leftover is what we see on the right.

I made the adjustment to 33.33% and it fits nicely.

Thanks for your help
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question